Skip to content

Commit

Permalink
Properly conditionally show a single toast when completing Basic Info…
Browse files Browse the repository at this point in the history
…rmation
  • Loading branch information
samau3 committed Sep 4, 2024
1 parent f847af7 commit 3480653
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions client/src/pages/patients/PatientRegistration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,9 @@ export default function PatientRegistration() {
'Patient basic information has been successfully updated.',
);
}
}

if (res.status === StatusCodes.BAD_REQUEST) {
} else if (res.status === StatusCodes.BAD_REQUEST) {
throw new Error('Invalid patient ID URL.');
}

if (!res.status.ok) {
} else {
throw new Error('Failed to register patient.');
}
} catch (err) {
Expand All @@ -207,17 +203,15 @@ export default function PatientRegistration() {
showSuccessNotification(
'Patient information has been successfully updated.',
);
}

if (res.status === StatusCodes.BAD_REQUEST) {
} else if (res.status === StatusCodes.BAD_REQUEST) {
throw new Error('Invalid data provided.');
}

if (res.status === StatusCodes.NOT_FOUND) {
else if (res.status === StatusCodes.NOT_FOUND) {
throw new Error('Patient ID not found.');
}

if (!res.status.ok) {
else {
throw new Error('Failed to update patient.');
}
} catch (err) {
Expand Down

0 comments on commit 3480653

Please sign in to comment.