custom fetcher #8695
Unanswered
lucas-garrido
asked this question in
Q&A
custom fetcher
#8695
Replies: 2 comments
-
|
Something like this is working : export const apiGraphQLFetcher = async <D, V> (query: TypedDocumentNode<D, V>, fetchParams = {}) : Promise<D> => {
const graphQLClient = await getGraphQLInstance();
return graphQLClient.request(query, fetchParams);
}; const { data, error } = useSWR([userGridProfileQuery, gridStateParams], (a, b) => apiGraphQLFetcher(a, b));but im not sure this is the clean way 🤨 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
this is working well rn: export const apiGraphQLFetcher: typeof GraphQLClient.prototype.request = async (
document,
variables?,
) => {
const graphQLClient = await getGraphQLInstance();
return graphQLClient.request(document, variables);
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi 🤚
i'm using swr and graphql-request and I would like to get the data type and params using a custom fetcher like this :
any idea ?
Beta Was this translation helpful? Give feedback.
All reactions