I am writing mutation for logging in user in NodeJS.
It is giving error "Must Provide Name".
Here is Browser GraphQL Query:
mutation{
login(username:"dfgdfg",password:"test1234") {
_id,
name{
fname,
lname,
mname
}
}
}
Here is my code
const login = {
type: UserType,
args: {
input:{
name:'Input',
type: new GraphQLNonNull(new GraphQLObjectType(
{
username:{
name:'Username',
type: new GraphQLNonNull(GraphQLString)
},
password:{
name:'Password',
type: new GraphQLNonNull(GraphQLString)
}
}
))
}
},
resolve: async (_, input, context) => {
let errors = [];
return UserModel.findById("5b5c34a52092182f26e92a0b").exec();
}
}
module.exports = login;
Could anyone please help me out why it is giving error?
Thanks in advance.