Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Better handling of the modal #214

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const Register = () => {
// Only email conflict
setModalContent(errorData.email);
} else {
setModalContent(errorData.error)
setModalContent(errorData.error || 'An error occurred!')
}
} else if (response.status == 226) {
setModalContent('User with same credentials already exists!');
Expand All @@ -84,7 +84,7 @@ const Register = () => {
const handleModalClose = () => {
setShowModal(false);
if (modalContent === 'Verification link has been sent by email!') {
Router.push('https://ca-frontend-ebon.vercel.app/');
Router.push('/');
}
};

Expand Down Expand Up @@ -286,7 +286,7 @@ const Register = () => {
<div className='rounded-lg bg-grey p-5 shadow-lg'>
<p>{modalContent}</p>
<button
onClick={() => setShowModal(false)}
onClick={handleModalClose}
className='text-white m-4 rounded-full bg-red px-4 py-2'
>
Okay
Expand Down