Answers
- The query syntax is incorrect – the syntax is like JSON but doesn’t have colons and commas. Also, the
query
keyword can be omitted, but it is best practice to include this. Here is the corrected query:query {
viewer {
name
email
}
}
- The following mutation will unstar a GitHub repository:
mutation ($repoId: ID!) {
removeStar(input: { starrableId: $repoId }) {
starrable {
stargazers {
totalCount
}
}
}
}
- The request is missing the HTTP
POST
method:const response = await fetch(process.env.REACT_APP_API_URL!, {
method: 'POST',
body: JSON.stringify({
query: GET_DATA_QUERY,
}),
});
- The authorization access token gets specified when Apollo Client...