Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
kind === "OperationDefinition" &&
operation === "subscription" &&
process.browser
);
},
wsLink,
httpLink
);
return new ApolloClient({
cache,
link: authLink.concat(link)
});
}
export default withApollo(createClient);
// const endpoint = process.browser
// ? config.clientEndpoint
// : config.serverEndpoint;
// function createClient() {
// const cache = new InMemoryCache();
// const httpLink = new HttpLink({
// uri: endpoint,
// credentials: "same-origin"
// });
// const wsLink = process.browser
// ? new WebSocketLink({
// uri: "ws://localhost/graphql",
// options: {
// reconnect: true
// function createClient({ headers, initialState }) {
// return new ApolloClient({
// uri: process.env.NODE_ENV === 'development' ? endpoint : prodEndpoint,
// cache: new InMemoryCache().restore(initialState || {}),
// request: operation => {
// operation.setContext({
// fetchOptions: {
// credentials: 'include',
// },
// headers,
// });
// },
// });
// }
export default withApollo(createClient);
// export default createClient;
toggleCart(_, variables, { cache }) {
const { cartOpen } = cache.readQuery({ query: LOCAL_STATE_QUERY });
const data = { data: { cartOpen: !cartOpen } };
cache.writeData(data);
return data;
},
},
},
defaults: {
cartOpen: false,
},
},
});
}
export default withApollo(createClient);
const data = {
data: { cartOpen: !cartOpen }
};
cache.writeData(data);
return data;
}
}
},
defaults: {
cartOpen: false
}
}
});
}
export default withApollo(createClient);
};
cache.writeData(data);
return data;
}
}
},
defaults: {
cartOpen: false,
me: null,
products: [],
}
}
});
}
export default withApollo(createClient);
});
const cache = new InMemoryCache({
fragmentMatcher
});
const link = new HttpLink({
uri: 'http://localhost:5511/graphql'
});
return new ApolloClient({
cache,
link
});
};
export const withData = withApollo(createApolloClient, {
getDataFromTree: "never"
});
uri:
process.env.NODE_ENV === 'development'
? DEV_API_ENDPOINT
: PROD_API_ENDPOINT,
request: operation => {
operation.setContext({
fetchOptions: {
credentials: 'include'
},
headers
});
}
});
}
export default withApollo(createClient);
const ENDPOINT =
process.env.NODE_ENV === 'development'
? `http://${cleanHostname(host)}:3000/graphql`
: `https://loginplify.${host}/graphql`
return new ApolloClient({
uri: ENDPOINT,
request: operation => {
operation.setContext({
headers
})
}
})
}
export default withApollo(createClient)