Files
memesearch-frontend/lib/apollo/server.ts
T
2026-06-24 15:59:13 +02:00

15 lines
556 B
TypeScript

'use server'
import { HttpLink } from '@apollo/client'
import { ApolloClient, InMemoryCache, registerApolloClient } from '@apollo/client-integration-nextjs'
// This is the server-side client
export const createApolloClient = async (cookie?: string) => registerApolloClient(() => {
return new ApolloClient({
link: new HttpLink({
uri: process.env.NODE_ENV == 'production' ? 'https://memesearch-backend.elliot-at-zuri.ch/graphql' : process.env.NEXT_PUBLIC_BACKEND_URI,
credentials: 'include',
}),
cache: new InMemoryCache()
})
})