underCat.js 520 B

12345678910111213
  1. const getGQL = url =>
  2. (query, variables={}) =>
  3. fetch(url,
  4. {method: 'POST',
  5. headers: {
  6. 'Accept': 'application/json',
  7. 'Content-Type': 'application/json',
  8. ...(localStorage.authToken ? {Authorization: `Bearer ${localStorage.authToken}`} : {})
  9. },
  10. body: JSON.stringify({query,variables})})
  11. .then(res => res.json())
  12. const gql = getGQL("http://shop-roles.asmer.fs.a-level.com.ua/graphql");