Skip to content

Instantly share code, notes, and snippets.

@DomDumont
Last active November 23, 2017 16:09
Show Gist options
  • Save DomDumont/bfb8808f70c92732e5a61e6751510b3d to your computer and use it in GitHub Desktop.
Save DomDumont/bfb8808f70c92732e5a61e6751510b3d to your computer and use it in GitHub Desktop.
signinUser: async (root, data, { mongo: { Users } }) => {
const user = await Users.findOne({ email: data.email.email });
if (user === null) {
throw new Error("Email not found !!");
}
if (data.email.password === user.password) {
return { token: `token-${user.email}`, user };
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment