We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, this example doesn't work:
const makeGraphqlRequest = async ({ endpoint, document }) => { const options = { method: 'POST', headers: new Headers({ 'Content-Type': 'application/json' }), body: JSON.stringify({ query: document }) } const response = await fetch(endpoint, options); return response.json() } const result = await makeGraphqlRequest({ endpoint: 'https://api.graphql.guide/graphql', document: '{ githubStars }' }); console.log(result);
await can't be used outside of the async, I guess it should be changed to the code you have in jsbin:
await
async
const makeGraphqlRequest = async ({ endpoint, document }) => { const options = { method: 'POST', headers: new Headers({ 'Content-Type': 'application/json' }), body: JSON.stringify({ query: document }) } const response = await fetch(endpoint, options) return response.json() } async function fetchExample() { const document = '{ githubStars }' console.log('Sending query: ' + document) const result = await makeGraphqlRequest({ endpoint: 'https://api.graphql.guide/graphql', document }) console.log('Response:', result) } fetchExample()
The text was updated successfully, but these errors were encountered:
fcb3859
Thanks Ivan! Fixed, and will be included in r3
Sorry, something went wrong.
No branches or pull requests
Hi, this example doesn't work:
await
can't be used outside of theasync
, I guess it should be changed to the code you have in jsbin:The text was updated successfully, but these errors were encountered: