Welcome to mirror list, hosted at ThFree Co, Russian Federation.

graphql.js « lib « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ae02559415c3b0c152a1e17a86492246ee577cf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { createUploadLink } from 'apollo-upload-client';
import csrf from '~/lib/utils/csrf';

export default (resolvers = {}) =>
  new ApolloClient({
    link: createUploadLink({
      uri: `${gon.relative_url_root}/api/graphql`,
      headers: {
        [csrf.headerKey]: csrf.token,
      },
    }),
    cache: new InMemoryCache(),
    resolvers,
  });