Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function create(initialState) {
return new ApolloClient({
connectToDevTools: process.browser,
ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once)
link: new HttpLink({
uri: 'http://localhost:3100/graphql', // Server URL (must be absolute)
opts: {
credentials: 'same-origin', // Additional fetch() options like `credentials` or `headers`
},
}),
cache: new InMemoryCache().restore(initialState || {}),
});
}