const getGQL = (url) => (query, variables = {}) => fetch(url, { method: "POST", headers: { //Accept: "application/json", "Content-Type": "application/json", ...(localStorage.authToken ? { Authorization: "Bearer " + localStorage.authToken } : {}), }, body: JSON.stringify({ query, variables }), }).then((res) => res.json()); console.log(getGQL); export const gql = getGQL("/graphql");