Restore intended flash messages (#23152)
Addresses #23139 and #23141 - Remove a premature `return` that prevented subsequent `renderFlash` from firing - Fix order of `push` and subsequent `renderFlash` for correct behavior - Check codebase for additional instances of problematic `push` calls _after_ associated `renderFlash` calls via regex `\renderFlash\([\s\S\n]{0,400}router\.push/` - Misc cleanup  - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
co-authored by
Jacob Shandling
parent
fe9ccd23c6
commit
de7c792945
@@ -295,12 +295,11 @@ const TeamDetailsWrapper = ({
|
||||
|
||||
try {
|
||||
await teamsAPI.destroy(teamIdForApi);
|
||||
return router.push(PATHS.ADMIN_TEAMS);
|
||||
router.push(PATHS.ADMIN_TEAMS);
|
||||
renderFlash("success", "Team removed");
|
||||
} catch (response) {
|
||||
renderFlash("error", "Something went wrong removing the team");
|
||||
console.error(response);
|
||||
return false;
|
||||
} finally {
|
||||
toggleDeleteTeamModal();
|
||||
setIsUpdatingTeams(false);
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ const DeleteTeamModal = ({
|
||||
}: IDeleteTeamModalProps): JSX.Element => {
|
||||
return (
|
||||
<Modal
|
||||
title={"Delete team"}
|
||||
title="Delete team"
|
||||
onExit={onCancel}
|
||||
onEnter={onSubmit}
|
||||
className={baseClass}
|
||||
|
||||
@@ -547,11 +547,11 @@ const HostDetailsPage = ({
|
||||
setIsUpdatingHost(true);
|
||||
try {
|
||||
await hostAPI.destroy(host);
|
||||
router.push(PATHS.MANAGE_HOSTS);
|
||||
renderFlash(
|
||||
"success",
|
||||
`Host "${host.display_name}" was successfully deleted.`
|
||||
);
|
||||
router.push(PATHS.MANAGE_HOSTS);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
renderFlash(
|
||||
|
||||
Reference in New Issue
Block a user