Skip to content

Commit

Permalink
chore: add toast for duplicate entries!
Browse files Browse the repository at this point in the history
  • Loading branch information
ayussh-2 committed Oct 27, 2024
1 parent e2b89f5 commit 2514976
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/app/register/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,15 @@ function Page() {
}, 1300);
} catch (error) {
console.error(error);
toast.error('Registration failed! If the issue persists, try logging in again.', {
duration: 5000,
});
if (error.message.includes('Unique constraint failed')) {
toast.error('Registration failed! User already exists with the same credentials!', {
duration: 5000,
});
} else {
toast.error('Registration failed! If the issue persists, try logging in again.', {
duration: 5000,
});
}
} finally {
setLoading(false);
}
Expand Down

0 comments on commit 2514976

Please sign in to comment.