2022-09-09 11:53:35 +00:00
|
|
|
import { ClientOptions, dedupExchange, fetchExchange, createClient, Exchange } from '@urql/core'
|
|
|
|
import { devtoolsExchange } from '@urql/devtools'
|
|
|
|
|
|
|
|
// FIXME actual value
|
|
|
|
const isDev = true
|
|
|
|
|
2022-09-14 14:21:26 +00:00
|
|
|
// export const baseUrl = 'https://newapi.discours.io'
|
|
|
|
export const baseUrl = 'http://localhost:8000'
|
2022-09-09 11:53:35 +00:00
|
|
|
|
|
|
|
const exchanges: Exchange[] = [dedupExchange, fetchExchange]
|
|
|
|
|
|
|
|
if (isDev) {
|
|
|
|
exchanges.unshift(devtoolsExchange)
|
|
|
|
}
|
|
|
|
|
|
|
|
const options: ClientOptions = {
|
|
|
|
url: baseUrl,
|
|
|
|
maskTypename: true,
|
|
|
|
requestPolicy: 'cache-and-network',
|
|
|
|
exchanges
|
|
|
|
}
|
|
|
|
|
|
|
|
export const publicGraphQLClient = createClient(options)
|