Complete the code to query a GraphQL API for a user's name.
query { user(id: [1]) { name } }The user ID must be a string in quotes in GraphQL queries.
Complete the code to handle errors in a GraphQL response.
if (response.[1]) { console.error(response.errors); }
GraphQL responses include an 'errors' field when errors occur.
Fix the error in the GraphQL query to fetch a user's email.
query { user(id: [1]) { email } }The ID must be a string in double quotes for the query to work correctly.
Fill both blanks to check if a GraphQL response has errors and log them.
if (response.[1] && response.[2].length > 0) { console.log('Errors found'); }
GraphQL errors are in the 'errors' array; check if it exists and has items.
Fill all three blanks to extract data, check errors, and handle them in GraphQL response.
const [1] = response.[2]; if (response.[3]) { console.error('GraphQL errors:', response.errors); }
Extract 'data' from response, check 'errors' field to handle errors.
