UNPKG

@prg/gatsby-source-something-whatever

Version:

something something whatever who gives a crap.

35 lines (27 loc) 947 B
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.createClient = void 0; var _isomorphicFetch = _interopRequireDefault(require("isomorphic-fetch")); var _apolloClient = require("apollo-client"); var _apolloLinkHttp = require("apollo-link-http"); var _apolloCacheInmemory = require("apollo-cache-inmemory"); const createClient = (accessToken, apiVersion = `v1`) => { const uri = `https://platform-hasura.onrender.com/${apiVersion}/graphql`; const headers = { 'Content-Type': 'application/json', 'x-hasura-admin-secret': accessToken }; const cache = new _apolloCacheInmemory.InMemoryCache(); const link = new _apolloLinkHttp.createHttpLink({ uri, headers, fetch: _isomorphicFetch.default }); const client = new _apolloClient.ApolloClient({ link, cache }); return client; }; exports.createClient = createClient;