diff options
author | Phil Hughes <me@iamphill.com> | 2019-04-02 10:26:09 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-04-02 11:34:17 +0300 |
commit | 07e61875de710e9162f7a41b71eea8cd0bca3cf3 (patch) | |
tree | f84975f29e48e4b963860b86218aee731abd741a /app | |
parent | 1b6fe3ae226e4c6f481c90c886e242fcd96ab11b (diff) |
CE backport of design-management-upload-client
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/lib/graphql.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/app/assets/javascripts/lib/graphql.js b/app/assets/javascripts/lib/graphql.js index 64e4e899f44..ae02559415c 100644 --- a/app/assets/javascripts/lib/graphql.js +++ b/app/assets/javascripts/lib/graphql.js @@ -1,11 +1,16 @@ -import ApolloClient from 'apollo-boost'; +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 (clientState = {}) => +export default (resolvers = {}) => new ApolloClient({ - uri: `${gon.relative_url_root}/api/graphql`, - headers: { - [csrf.headerKey]: csrf.token, - }, - clientState, + link: createUploadLink({ + uri: `${gon.relative_url_root}/api/graphql`, + headers: { + [csrf.headerKey]: csrf.token, + }, + }), + cache: new InMemoryCache(), + resolvers, }); |