axios graphql query code example
Example: how to make graphql request in axios
const data = await axios.post(API_URL, {
query: `mutation updateUserCity($id: Int!, $city: String!) {
updateUserCity(userID: $id, city: $city){
id
name
age
city
knowledge{
language
frameworks
}
}
}`,
variables: {
id: 2,
city: 'Test'
}
}, {
headers: {
'Content-Type': 'application/json'
}
})