12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- const getGQL = url =>
- (query, variables) =>
- fetch(url, {
- method: 'POST',
- headers: {
- "content-type": "application/json"
- },
- body: JSON.stringify({query, variables})
- }).then(res => res.json())
- let gql = getGQL('http://shop-roles.asmer.fs.a-level.com.ua/graphql')
- async function goodFind() {
- await gql(`query {
- GoodFind(query: "[{}]"){
- _id
- name
- price
- images{
- url
- }
- }
- }`
- ).then(res=>console.log(res))}
- goodFind()
- async function categoryFind() {
- await gql(`query {
- CategoryFind(query: "[{}]"){
- _id
- name
- goods {
- _id name
- }
- }
- }`).then(result => console.log(result))
- }
- categoryFind()
- //eto mne nel'zya
- // async function orderGood() {
- // await gql(`query {
- // OrderGoodFind(query: "[{}]"){
- // _id
- // price
- // count
- // good{
- // _id
- // }
- // }
- // }`).then(result => console.log(result))
- // }
- // orderGood()
|