I am running an apollo graphql backend and vanilla javascript fetch API in front-end it is running in chrome extension the Query works fine but the Mutation doesn't work and is returning a 400 error I am running this in Chrome extension and the query in there works
fetch('https://dev.api.sharpstudy.io/graphql', {
method: 'POST',
headers: {
authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: "application/json, text/plain"
},
body: JSON.stringify({
query: `
mutation createBrowserTab {
createBrowserTab (userId: ${userId}, tabName: ${title}, tabDescription: ${title}, tabUrl:${url}, subjectId: ${subId}){
SavedBrowserTab {
tabId
tabUrl
tabName
tabDescription
subjectId
userId
}
message
}
}
`,
// variables: {
// userId: userId,
// title: title,
// url: url,
// subId: subId
// },
}),
})
.then((res) => res.json())
.then((result) => console.log(result));