apollo.ts

 1import { ApolloClient, InMemoryCache, createHttpLink } from '@apollo/client'
 2
 3const httpLink = createHttpLink({
 4  uri: '/graphql',
 5  // include credentials so future httpOnly auth cookies are sent automatically
 6  credentials: 'include',
 7})
 8
 9export const client = new ApolloClient({
10  link: httpLink,
11  cache: new InMemoryCache({
12    typePolicies: {
13      // Repository has no id field — treat as a singleton per cache
14      Repository: {
15        keyFields: [],
16      },
17    },
18  }),
19})