When I manually write the mutation query (in graphql plugin), it's working:
mutation {
createExam(input: {
data: {
name: "myName"
desription: "ggg"
questions: [{gf: "hello"}]
time: 2
subjects: ["5c468e2d61670b25b46ccdfe"]
}
}) {
exam {
name
desription
time
}
}
}
But if I code it and pass the exact same array I get an array of the exact same object I get [null, null]
let parsedQuestion = [{gf: "hello"}];
const response = await strapi.request('POST', '/graphql', {
data: {
query: `mutation {
createExam(input: {
data: {
name: "` + examInfo.newExamName + `"
desription: "` + examInfo.newExamDescription + `"
time: ` + Number(examInfo.newExamTime) + `,
questions: `+ parsedQuestion + `,
subjects: ["` + this.state.modalSubject._id + `"]
}
}) {
exam {
name
desription
time
questions
}
}
}`
}
How can it be? Could it be a bug? I also tried with JSON.stringify but then got an error and the mutation didn't even come through
Thanks a lot in advance