Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Closes #152] Reduce frequency of success toast on register patient form #154

Merged
merged 2 commits into from
Nov 1, 2024
Merged
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
13 changes: 3 additions & 10 deletions client/src/pages/patients/register/PatientRegistration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,6 @@ export default function PatientRegistration() {
try {
const res = await LifelineAPI.registerPatient(data, patientId);
if (res.status === StatusCodes.CREATED) {
showSuccessNotification(
'Patient basic information has been successfully registered.',
);
setShowCheck((prevShowCheck) => ({
...prevShowCheck,
patientData: true,
Expand All @@ -360,9 +357,6 @@ export default function PatientRegistration() {
patientId,
);
if (updateRes.status === StatusCodes.OK) {
showSuccessNotification(
'Patient basic information has been successfully updated.',
);
setShowCheck((prevShowCheck) => ({
...prevShowCheck,
patientData: true,
Expand Down Expand Up @@ -391,9 +385,6 @@ export default function PatientRegistration() {
try {
const res = await LifelineAPI.updatePatient(data, patientId);
if (res.status === StatusCodes.OK) {
showSuccessNotification(
'Patient information has been successfully updated.',
);
setShowCheck((prevShowCheck) => ({
...prevShowCheck,
[Object.keys(data)[0]]: true,
Expand All @@ -404,7 +395,9 @@ export default function PatientRegistration() {
throw new Error('Invalid data provided.');
}
if (res.status === StatusCodes.NOT_FOUND) {
throw new Error('Patient ID not found.');
throw new Error(
'Patient ID not found. Please ensure the Basic Information section is filled out correctly.',
);
}

throw new Error('Failed to update patient.');
Expand Down