Add Apollo Client and GraphQL dependencies, and

create Apollo Client instance.
This commit is contained in:
Dede Fuji Abdul
2023-11-08 15:33:49 +07:00
parent 6f0f8d5ed7
commit c96988f97f
3 changed files with 445 additions and 4 deletions

16
src/utils/graphql.ts Normal file
View File

@ -0,0 +1,16 @@
import { ApolloClient, createHttpLink, InMemoryCache } from '@apollo/client/core'
// HTTP connection to the API
const httpLink = createHttpLink({
// You should use an absolute URL here
uri: 'http://localhost:3020/graphql',
})
// Cache implementation
const cache = new InMemoryCache()
// Create the apollo client
export const apolloClient = new ApolloClient({
link: httpLink,
cache,
})