Open mrnasil opened 1 month ago
Hi @mrnasil
here 's the way I create a basic graphql client in my utils
folder
export const $graphqlClient = async (query: string, variables?: object) => {
const { data, errors } = await $fetch( ~SERVER_ENDPOINT~, {
method: 'POST',
headers: {
"Content-Type": "application/json",
"x-secret": ~SECRET-TOKEN~
},
body: {
query,
variables
}
})
return { data, errors }
}
Hi @mrnasil
here 's the way I create a basic graphql client in my
utils
folderexport const $graphqlClient = async (query: string, variables?: object) => { const { data, errors } = await $fetch( ~SERVER_ENDPOINT~, { method: 'POST', headers: { "Content-Type": "application/json", "x-secret": ~SECRET-TOKEN~ }, body: { query, variables } }) return { data, errors } }
"Thank you very much for your response. I also use it in the same way. However, I believe it would be more appropriate for it to be included within ofetch as an optional feature.
Describe the feature
I am wondering if GraphQL support can be added without going into too much detail.