Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function createApolloClient(initialState = {}) {
const httpLink = new HttpLink({
uri: 'http://localhost:3000/graphql',
});
const cacheOptions = {
dataIdFromObject: o => o.id,
};
const persistOptions = {
initialState,
};
const client = ApolloClientIDB.create(
{
link: httpLink,
},
{
cacheOptions,
persistOptions,
},
);
/*
const client = new ApolloClient({
link: httpLink,
cache: new ApolloCache(cacheOptions, cachePersistOption),
});*/
client.setOfflineOptions({
manualExecution: false, //optional