fix: remove copy+paste oversights

In the registration resolvers, it makes sense to immediately resolve if
an email address has been found (because you can re-send the
registration email).

In this case, we use the helper method only to trigger the `UserInputError`.
This commit is contained in:
roschaefer 2019-10-02 01:39:40 +02:00
parent 6ffafff288
commit e6f8bbac9b

View File

@ -7,6 +7,7 @@ import Validator from 'neode/build/Services/Validator.js'
export default {
Mutation: {
AddEmailAddress: async (_parent, args, context, _resolveInfo) => {
let response
try {
const { neode } = context
await new Validator(neode, neode.model('UnverifiedEmailAddress'), args)
@ -14,8 +15,8 @@ export default {
throw new UserInputError('must be a valid email')
}
let response = await existingEmailAddress(_parent, args, context)
if (response) return response
// check email does not belong to anybody
await existingEmailAddress(_parent, args, context)
const nonce = generateNonce()
const {