Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the error thrown by useAsyncGql will result in null data #212

Open
NewYorkDoll opened this issue Sep 28, 2022 · 2 comments
Open

the error thrown by useAsyncGql will result in null data #212

NewYorkDoll opened this issue Sep 28, 2022 · 2 comments

Comments

@NewYorkDoll
Copy link

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
    }
  }
}
@j-tap
Copy link

j-tap commented Dec 13, 2022

Same problem. No update on this?
UPD: In my case, I solved it by adding: useGqlHeaders({ Accept: 'application/json' });

@talaxasy
Copy link

Same problem. No update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants