The graphQL server is set up. It works properly when the values are hardcoded. Here is my invocation request:
"query": "mutation{
createEvent(name: "+ name +", purpose: "+ purpose +", googleUserName: "+ googleUserName +", dateArray: "+ JSON.stringify(dateArray) +", attendees: [])
{
eventId
name
purpose
googleUserName
dateArray
attendees{
attendeeName
personalizedDateSelection
}
}
}"
This gives the error:
{"errors":
[{"message":
"Syntax Error GraphQL request (1:88) Expected :, found Name \"dateArray\"\n\n1: mutation{createEvent(name: lakshman, purpose: test, googleUserName: Diwaakartg Ganesh, dateArray: [\"Wed, Nov 9th 2016\",\"Thu, Nov 10th 2016\",\"Thu, Nov 3rd 2016\",\"Wed, Nov 2nd 2016\"], attendees: [])
{eventId
name
purpose
googleUserName
dateArray
attendees{
attendeeName
personalizedDateSelection
}
}
}\n}]}
There is no alignment error. I have made it so to enhance the readability But, the above mutation works properly when hardcoded the arguments. I find it pretty difficult to find what is the cause of the error. I have tried both JSON.stringify(dateArray) and just the dateArray alone.
Or is there a better approach to query GraphQL from react-redux app?