const GraphQLClient = require("graphql-request").GraphQLClient;

//New bug introduced with Graphql Request.
// https://github.com/prisma-labs/graphql-request/issues/206
// const { Headers } = require("cross-fetch");
// global.Headers = global.Headers || Headers;

const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
  headers: {
    "x-hasura-admin-secret": process.env.HASURA_ADMIN_SECRET
  }
});

const unauthorizedClient = new GraphQLClient(process.env.GRAPHQL_ENDPOINT);

module.exports = {
  client,
  unauthorizedClient
};
