in fusion-plugin-apollo/src/apollo-client/index.js [119:150]
function getClient(ctx, initialState) {
const cache = getCache(ctx);
const connectionLink =
schema && __NODE__
? new SchemaLink({
schema,
context:
typeof apolloContext === 'function'
? apolloContext(ctx)
: apolloContext,
})
: new HttpLink({
uri: endpoint,
credentials: includeCredentials,
fetch,
});
const links: Array<ApolloLinkType> = getApolloLinks
? getApolloLinks([connectionLink], ctx)
: [connectionLink];
const client = new ApolloClient({
ssrMode: __NODE__,
connectToDevTools: __BROWSER__ && __DEV__,
link: apolloLinkFrom(links),
cache: cache.restore(initialState),
resolvers,
typeDefs,
defaultOptions,
});
return client;
}