const getGQL = url => 
    (query, variables={}) => 
        fetch(url, 
            {method: 'POST', 
                headers: {
                  'Accept': 'application/json',
                  'Content-Type': 'application/json',
                  ...(localStorage.authToken && localStorage.authToken != 'null' ? {Authorization: `Bearer ${localStorage.authToken}`} : {})
                },
                body: JSON.stringify({query,variables})})
        .then(res => res.json())

const gql = getGQL("http://shop-roles.asmer.fs.a-level.com.ua/graphql");

const urlUpload = "http://shop-roles.asmer.fs.a-level.com.ua";

export  {gql, urlUpload};