-
Notifications
You must be signed in to change notification settings - Fork 514
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
added toast messages on facility and skills dialog #7448
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -639,6 +639,15 @@ function UserFacilities(props: { user: any }) { | |||||||||||||
body: { home_facility: facility.id.toString() }, | ||||||||||||||
}); | ||||||||||||||
if (res && res.status === 200) user.home_facility_object = facility; | ||||||||||||||
if (res?.status !== 200) { | ||||||||||||||
Notification.Error({ | ||||||||||||||
msg: "Error while updating Home facility", | ||||||||||||||
}); | ||||||||||||||
} else { | ||||||||||||||
Notification.Success({ | ||||||||||||||
msg: "Home Facility updated successfully", | ||||||||||||||
}); | ||||||||||||||
} | ||||||||||||||
await refetchUserFacilities(); | ||||||||||||||
setIsLoading(false); | ||||||||||||||
}; | ||||||||||||||
|
@@ -650,11 +659,29 @@ function UserFacilities(props: { user: any }) { | |||||||||||||
pathParams: { username }, | ||||||||||||||
}); | ||||||||||||||
if (res && res.status === 204) user.home_facility_object = null; | ||||||||||||||
if (res?.status !== 204) { | ||||||||||||||
Notification.Error({ | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
msg: "Error while clearing home facility", | ||||||||||||||
}); | ||||||||||||||
} else { | ||||||||||||||
Notification.Success({ | ||||||||||||||
msg: "Home Facility cleared successfully", | ||||||||||||||
}); | ||||||||||||||
} | ||||||||||||||
} else { | ||||||||||||||
await request(routes.deleteUserFacility, { | ||||||||||||||
const { res } = await request(routes.deleteUserFacility, { | ||||||||||||||
pathParams: { username }, | ||||||||||||||
body: { facility: unlinkFacilityData?.facility?.id?.toString() }, | ||||||||||||||
}); | ||||||||||||||
if (res?.status !== 204) { | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
Notification.Error({ | ||||||||||||||
msg: "Error while unlinking home facility", | ||||||||||||||
}); | ||||||||||||||
} else { | ||||||||||||||
Notification.Success({ | ||||||||||||||
msg: "Facility unlinked successfully", | ||||||||||||||
}); | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
await refetchUserFacilities(); | ||||||||||||||
hideUnlinkFacilityModal(); | ||||||||||||||
|
@@ -667,10 +694,17 @@ function UserFacilities(props: { user: any }) { | |||||||||||||
pathParams: { username }, | ||||||||||||||
body: { facility: facility.id.toString() }, | ||||||||||||||
}); | ||||||||||||||
|
||||||||||||||
console.log(res); | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
if (res?.status !== 201) { | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
Notification.Error({ | ||||||||||||||
msg: "Error while linking facility", | ||||||||||||||
}); | ||||||||||||||
} else { | ||||||||||||||
Notification.Success({ | ||||||||||||||
msg: "Facility linked successfully", | ||||||||||||||
}); | ||||||||||||||
} | ||||||||||||||
await refetchUserFacilities(); | ||||||||||||||
setIsLoading(false); | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rithviknishad,
I just wanted to confirm the proposed changes. It seems like user.home_facility_object = facility; should be moved to the else statement. If this adjustment aligns with our intentions, I can proceed with pushing the code.
Let me know if there are any concerns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes, you are right. my bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made some updates to the pull request:
Please review the changes and let me know if there are any further adjustments needed. Looking forward to your feedback!