webapp/src/graphql/publicGraphQLClient.ts

20 lines
559 B
TypeScript
Raw Normal View History

2022-11-20 18:49:44 +00:00
import { ClientOptions, dedupExchange, fetchExchange, Exchange, createClient } from '@urql/core'
2022-09-09 11:53:35 +00:00
import { devtoolsExchange } from '@urql/devtools'
2022-10-25 16:25:42 +00:00
import { isDev, apiBaseUrl } from '../utils/config'
2022-11-21 00:26:20 +00:00
// import { cache } from './cache'
2022-09-09 11:53:35 +00:00
2022-11-19 13:43:25 +00:00
const exchanges: Exchange[] = [dedupExchange, fetchExchange] //, cache]
2022-09-09 11:53:35 +00:00
if (isDev) {
exchanges.unshift(devtoolsExchange)
}
const options: ClientOptions = {
2022-12-17 03:27:00 +00:00
url: apiBaseUrl + '/graphql',
2022-09-09 11:53:35 +00:00
maskTypename: true,
requestPolicy: 'cache-and-network',
exchanges
}
2022-11-20 18:49:44 +00:00
export const publicGraphQLClient = createClient(options)