Is there a way to get rid of [Object: null prototype] in GraphQL
You can do something like below,and [Object: null prototype] would disappear
const a = JSON.parse(JSON.stringify(args));
args.category
is
[[Object: null prototype] { id: '5c28c79af62fad2514ccc788' }],
JSON.parse(JSON.stringify(args.category) would be { id: '5c28c79af62fad2514ccc788' }
Normally, when passing InputTypes as an argument, I solve it using destructuring, like this:
addRecipe: async (root, { ...args }, { req }, info) => { // args.category = '5c28c79af62fad2514ccc788' // args.ingredient = '5c28c8deb99a9d263462a086' // console.log(args.map(x => x)) return Recipe.create(args)}
In the playground I changed in settings request credentials from omit to include and it worked, "request.credentials": "include"
I hope it helps.