---
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { HttpLink } from '@apollo/client'
|
||||
import { ApolloClient, InMemoryCache } from '@apollo/client'
|
||||
|
||||
// This is the client-side client
|
||||
export const apollo = 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,
|
||||
}),
|
||||
cache: new InMemoryCache(),
|
||||
})
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './client'
|
||||
export * from './server'
|
||||
@@ -0,0 +1,14 @@
|
||||
'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()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user