summaryrefslogtreecommitdiffstats
path: root/frontend/lib/withData.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-05-24 09:03:04 -0400
committerGitHub <noreply@github.com>2018-05-24 09:03:04 -0400
commitb294a6fa500b165aae86afbad5fce49a02314b0d (patch)
treef538c8b01f1ee41ea0c7cd0f58fcf7746b8accb8 /frontend/lib/withData.js
parentee068a81a5a8e71663c78135e5e865621dba53cb (diff)
parente040b70da6a48b1eb2f2b32132fa9b2244e92780 (diff)
Merge pull request #8 from peggyrayzis/apollo-feedback
Apollo feedback
Diffstat (limited to 'frontend/lib/withData.js')
-rw-r--r--frontend/lib/withData.js10
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;