fix(SW-663): Fixed caching issue by using new GraphQLClient for each request

This commit is contained in:
Erik Tiekstra
2024-11-06 12:40:57 +01:00
parent ae43ab440d
commit 0465f8e450
4 changed files with 27 additions and 32 deletions

View File

@@ -7,14 +7,15 @@ import { request as _request } from "./_request"
import { Data } from "@/types/request"
const client = new GraphQLClient(env.CMS_URL, {
fetch: fetch,
})
export async function edgeRequest<T>(
query: string | DocumentNode,
variables?: {},
params?: RequestInit
): Promise<Data<T>> {
// Creating a new client for each request to avoid conflicting parameters
const client = new GraphQLClient(env.CMS_URL, {
fetch: fetch,
})
return _request(client, query, variables, params)
}