Fixes: None; Extra: Removed unused files including layout, page components, and global styling to align with the new GraphQL integration;
26 lines
825 B
TypeScript
26 lines
825 B
TypeScript
import { ApolloClient, InMemoryCache, HttpLink } from '@apollo/client';
|
|
|
|
export const apolloClient = new ApolloClient({
|
|
ssrMode: typeof window === 'undefined',
|
|
link: new HttpLink({
|
|
uri: process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT,
|
|
credentials: 'include',
|
|
}),
|
|
cache: new InMemoryCache({
|
|
typePolicies: {
|
|
Query: {
|
|
fields: {
|
|
products: {
|
|
keyArgs: false,
|
|
merge(existing = { edges: [] }, incoming) {
|
|
return {
|
|
...incoming,
|
|
edges: [...existing.edges, ...incoming.edges],
|
|
};
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
});
|