diff options
| author | Peggy Rayzis <peggyrayzis@gmail.com> | 2018-05-22 12:52:21 -0400 |
|---|---|---|
| committer | Peggy Rayzis <peggyrayzis@gmail.com> | 2018-05-23 17:26:15 -0400 |
| commit | 21baf56ca199fd9743726c5166b02da4aa6d977b (patch) | |
| tree | ab0093cf3f88b0fe1bbad715739b8f158fe4360c /frontend | |
| parent | ee068a81a5a8e71663c78135e5e865621dba53cb (diff) | |
Small edits to client creation
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/lib/withData.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/frontend/lib/withData.js b/frontend/lib/withData.js index aa0ba88..6fc0213 100644 --- a/frontend/lib/withData.js +++ b/frontend/lib/withData.js @@ -5,9 +5,11 @@ import { LOCAL_STATE_QUERY } from '../queries/queries.graphql'; function createClient({ headers }) { return new ApolloClient({ - uri: process.env.NODE_ENV === 'development' ? 'http://localhost:4444' : 'http://localhost:4444', - ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once) - request: async operation => { + uri: + process.env.NODE_ENV === 'development' + ? 'http://localhost:4444' + : 'http://localhost:4444', + request: operation => { operation.setContext({ fetchOptions: { credentials: 'include', @@ -19,7 +21,7 @@ function createClient({ headers }) { resolvers: { Mutation: { toggleCart(_, variables, { cache }) { - const { cartOpen } = cache.read({ query: LOCAL_STATE_QUERY }); + const { cartOpen } = cache.readQuery({ query: LOCAL_STATE_QUERY }); const data = { data: { cartOpen: !cartOpen } }; cache.writeData(data); return data; |
