Last active
March 30, 2021 14:18
-
-
Save daniloab/fec19a5f6236e10fce7be03ef129b291 to your computer and use it in GitHub Desktop.
Query Me resolver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default new GraphQLObjectType({ | |
name: 'Query', | |
description: 'The root of all queries', | |
fields: () => ({ | |
me: { | |
type: UserType, | |
resolve: (root, args, context) => { | |
if (!context.user) { | |
return null; | |
} | |
const { password, ...user } = User.findById(context.user._id) | |
return user; | |
} | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment