Skip to content

Instantly share code, notes, and snippets.

@klyngen
Created February 22, 2022 01:48
Show Gist options
  • Save klyngen/3d03c6ab4773079f39c128b15e054abc to your computer and use it in GitHub Desktop.
Save klyngen/3d03c6ab4773079f39c128b15e054abc to your computer and use it in GitHub Desktop.
Enkel graphql-klient for å hente data fra sanity
import { ApolloClient, InMemoryCache } from '@apollo/client';
import config from '../config';
export const client = new ApolloClient({
uri: `https://${config.SANITY_PROJECT_ID}.apicdn.sanity.io/v1/graphql/${config.SANITY_DATASET}/${config.SANITY_TAG}`,
cache: new InMemoryCache(),
headers: {
Authorization: `Bearer ${config.SANITY_TOKEN}`,
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment