Created
June 5, 2019 08:30
-
-
Save desaijay315/45ca44b90258e0630cdfeabb3c8895cd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const resolvers = { | |
Mutation:{ | |
createNewUser(parent,args,ctx,info){ | |
const isEmailExists = users.some((user) => user.email === args.email) | |
if(isEmailExists){ | |
throw new Error('Email already Taken') | |
} | |
const user = { | |
id:uuidv4(), | |
name:args.name, | |
email:args.email, | |
age:args.age | |
} | |
users.push(user) | |
return user | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment