-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
I've added the field roles to my User type:
type User {
roles: [Role!]!
id: ID! @unique
email: String! @unique
password: String!
name: String!
inviteToken: String
inviteAccepted: Boolean! @default(value: "true")
emailConfirmed: Boolean! @default(value: "true")
emailConfirmToken: String
resetToken: String
resetExpires: DateTime
deletedAt: DateTime
lastLogin: DateTime
joinedAt: DateTime!
}and it works great when calling the currentUser query:
{
"data": {
"currentUser": {
"id": "cjl452gr600fr0a80uutqyuz9",
"email": "test.admin@example.com",
"roles": [
{
"title": "Administer"
}
]
}
}
}but even though it's a required field, it returns null with the AuthPayload of login mutation:
mutation {
login(email: "test.admin@example.com", password: "testadmin9875") {
token
user {
name
email
roles{
id
name
title
}
}
}
}
{
"data": {
"login": {
"token": "xxx",
"user": {
"name": "Test Admin",
"email": "test.admin@example.com",
"roles": null
}
}
}
}Any thoughts on why this is? Both the return types of currentUser and login reference the same User type. The resolvers for each handles them a bit differently.
currentUser: findUserById(ctx, id, info)
login: findUserByEmail(ctx, email)
info is an optional arg to findUserByEmail and it's not passed. Is this why it does not include other fields on the returned user? I'm having trouble following the flow...
Thanks!
murdockq
Metadata
Metadata
Assignees
Labels
No labels