1

I am trying to format this properly to pass it in to subscribe to a subscription. I keep receiving this error. Been tinkering with it for a while to no avail.

This is the string I am trying to properly format

"data": "{\"query\":\"subscription MySubscription {\\n  addedNewLocation(number: \\\"123456\\\") {\\n    id\\n  }\\n}\\n\",\"variables\":null}"

And I have tried this

const query = {
   query: `subscription MySubscription {addedNewLocation(number: "123456") {id}},"variables":null`,
};
const queryStr = JSON.stringify(query);

And this

const query = {
   query: `subscription MySubscription {addedNewLocation(number: "123456") {id}}`,
   variables: `null`
};
const queryStr = JSON.stringify(query);
programmerGuy
  • 137
  • 3
  • 11

0 Answers0