Running this Mutation GraphQL query:
mutation {
addProduct (input: { name: "Salad Roll", description : "Tasty Salad Roll" })
}
I'm getting this error:
"errors": [ { "message": "
addProduct
is an object, interface or union type field. Leaf selections on objects, interfaces, and unions without subfields are disallowed.",
How do I fix it?
The solution is to return a value:
mutation {
addProduct (input: { name: "Salad Roll", description : "Tasty Salad Roll" })
{
product
{
id
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With