nuxt-graphql-client
nuxt-graphql-client copied to clipboard
the error thrown by useAsyncGql will result in null data
hi @Diizzayy
I have a GQL res data body
CLICK ME
{
"errors": [
{
"message": "not authenticated",
"path": [
"self"
]
}
],
"data": {
"self": null,
"githubUser": {
"login": "NewYorkDoll",
"name": "yiziluoying",
"avatarURL": "https://avatars.githubusercontent.com/u/70010012?v=4",
"bio": "Just so so",
"email": null,
"location": null,
"htmlurl": "https://github.com/NewYorkDoll"
},
"version": {
"commit": "n/a",
"goVersion": "go1.19.1",
"date": "n/a"
},
"codingStats": {
"totalDuration": "11 hrs 6 mins",
"totalSeconds": 39960,
"calculatedDays": 30,
"languages": [
]
}
}
}
const { data, error } = await useAsyncGql('base')
// data = null
/**
error = {
"message": "not authenticated",
"path": [
"self"
]
}
*/
I expect data data to be available normally, just like GQL res, instead of being null.
my queries
query base {
self {
id
name
login
avatarURL
}
githubUser {
login
name
avatarURL
bio
email
location
htmlurl
}
version {
commit
goVersion
date
}
codingStats {
totalDuration
totalSeconds
calculatedDays
languages {
language
totalSeconds
}
}
}
Same problem. No update on this?
UPD: In my case, I solved it by adding: useGqlHeaders({ Accept: 'application/json' });
Same problem. No update on this?