I'm using GraphQL to connect to multiple RESTful endpoints. I'm writing a mutation to update user details, however GraphiQL is showing the following response of null rather than the updated user ID and name...
{
"data": {
"updateUser": null
}
}
updateUser: (parent, args) => {
const { id, name } = args;
return fetch(`${url}/users/${id}`, {
method: 'PUT',
body: JSON.stringify({ id, name }),
headers: { 'Content-Type': 'application/json' },
})
.then(res => res.json())
.then(json => console.log(json));
},
Thanks in advance.