Last active
October 5, 2017 19:05
-
-
Save a7v8x/b3541131895560395bd125abde93db08 to your computer and use it in GitHub Desktop.
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
const userMutations = { | |
createUser: { | |
type: UserType, | |
args: { | |
input: { | |
type: new GraphQLNonNull(UserInputType), | |
}, | |
}, | |
resolve: async (rootValue, { input }) => { | |
if (input.email && !isEmail(input.email)) { | |
throw new Error('Email is not in valid format'); | |
} | |
const result = await new Promise((resolve) => { | |
setTimeout(() => | |
resolve(Object.assign(input, { | |
id: random.uuid(), | |
})), 100); | |
}); | |
return result; | |
}, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment