Skip to content

Commit

Permalink
fix(demo): improve errors on signup route
Browse files Browse the repository at this point in the history
  • Loading branch information
unleashit committed Mar 11, 2024
1 parent ff68854 commit 8c3ec9d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion demos/backend/src/routes/signup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const demoUsers = [
email: 'test2@test2.com',
password: '12345678',
},
{
email: 'existing@user.com',
password: '12345678',
},
];

function validations({ email, password, passwordConfirm }: PostBody) {
Expand All @@ -43,7 +47,8 @@ function validations({ email, password, passwordConfirm }: PostBody) {
}

if (demoUsers.find((u) => u.email === email)) {
errors.root = 'That email is already associated with an account';
errors.root = 'This email is already associated with an account';
errors.email = 'Please login instead or choose a different email';
}

return errors;
Expand Down

0 comments on commit 8c3ec9d

Please sign in to comment.