This commit is contained in:
2026-06-24 15:34:09 +02:00
commit 65fb6816ca
442 changed files with 27246 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
'use server'
import { SESSION_COOKIE_NAME } from '@/constants'
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://wreckit-backend.elliot-at-zuri.ch/graphql' : process.env.NEXT_PUBLIC_BACKEND_URI,
credentials: 'include',
headers: {
cookie: cookie ? `${SESSION_COOKIE_NAME}=${cookie}` : ''
}
}),
cache: new InMemoryCache()
})
})