2019-05-18 00:54:41 +05:30
|
|
|
import { ApolloClient } from 'apollo-client';
|
|
|
|
import { InMemoryCache } from 'apollo-cache-inmemory';
|
|
|
|
import { createUploadLink } from 'apollo-upload-client';
|
2019-02-15 15:39:39 +05:30
|
|
|
import csrf from '~/lib/utils/csrf';
|
|
|
|
|
2019-05-18 00:54:41 +05:30
|
|
|
export default (resolvers = {}) =>
|
|
|
|
new ApolloClient({
|
|
|
|
link: createUploadLink({
|
|
|
|
uri: `${gon.relative_url_root}/api/graphql`,
|
|
|
|
headers: {
|
|
|
|
[csrf.headerKey]: csrf.token,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
cache: new InMemoryCache(),
|
|
|
|
resolvers,
|
|
|
|
});
|