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 /doc/development/fe_guide/graphql.md | |
parent | 1b6fe3ae226e4c6f481c90c886e242fcd96ab11b (diff) |
CE backport of design-management-upload-client
Diffstat (limited to 'doc/development/fe_guide/graphql.md')
-rw-r--r-- | doc/development/fe_guide/graphql.md | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/doc/development/fe_guide/graphql.md b/doc/development/fe_guide/graphql.md index 3290f29530a..5f6123b5f9b 100644 --- a/doc/development/fe_guide/graphql.md +++ b/doc/development/fe_guide/graphql.md @@ -46,7 +46,9 @@ Read more about [Vue Apollo][vue-apollo] in the [Vue Apollo documentation][vue-a ### Local state with `apollo-link-state` It is possible to use our Apollo setup with [apollo-link-state][apollo-link-state] by passing -in the client state object when creating the default client. +in a resolvers object when creating the default client. The default state can be set by writing +to the cache after setting up the default client. + ```javascript import Vue from 'vue'; @@ -54,15 +56,23 @@ import VueApollo from 'vue-apollo'; import createDefaultClient from '~/lib/graphql'; Vue.use(VueApollo); +const defaultClient = createDefaultClient({ + Query: { + ... + }, + Mutations: { + ... + }, +}); + +defaultClient.cache.writeData({ + data: { + isLoading: true, + }, +}); + const apolloProvider = new VueApollo({ - defaultClient: createDefaultClient({ - defaults: { - testing: true, - }, - resolvers: { - ... - }, - }), + defaultClient, }); ``` |