Skip to content

Instantly share code, notes, and snippets.

@daniloab
Last active March 30, 2021 14:18
Show Gist options
  • Save daniloab/fec19a5f6236e10fce7be03ef129b291 to your computer and use it in GitHub Desktop.
Save daniloab/fec19a5f6236e10fce7be03ef129b291 to your computer and use it in GitHub Desktop.
Query Me resolver
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