reject with unknow reason if failed to send confirmation email

This commit is contained in:
Hongbo Wu
2022-07-19 22:14:04 +08:00
committed by Jackson Harper
parent 1ea34bde62
commit b98f7c6ba2

View File

@ -99,12 +99,16 @@ export const createUser = async (input: {
const confirmationToken = generateVerificationToken(user.id)
const confirmationLink = `${env.client.url}/confirm-email/${confirmationToken}`
// send email
await sendEmail({
const sent = await sendEmail({
from: env.sender.message,
to: user.email,
subject: 'Confirm your email',
text: `Please confirm your email by clicking the link below:\n\n${confirmationLink}\n\n`,
})
if (!sent) {
return Promise.reject({ errorCode: SignupErrorCode.Unknown })
}
}
return [user, profile]