From 019eaecdaaed0703e4b2f3cb77c1e7f72fee9a27 Mon Sep 17 00:00:00 2001 From: Red J Adaya Date: Sun, 24 Dec 2023 04:31:11 +0800 Subject: [PATCH] Immediately hide modal when deleting workspace (#187) * immediately hide modal when deleting workspace * only pop modal when purging is successful --- src/app/common/modals/settings.tsx | 7 +++++-- src/util/util.ts | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/common/modals/settings.tsx b/src/app/common/modals/settings.tsx index 2eb606df..ce001b64 100644 --- a/src/app/common/modals/settings.tsx +++ b/src/app/common/modals/settings.tsx @@ -440,7 +440,7 @@ class SessionSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.sessionPurge(this.sessionId); - commandRtnHandler(prtn, this.errorMessage); + commandRtnHandler(prtn, this.errorMessage, () => GlobalModel.modalsModel.popModal()); }); } @@ -783,7 +783,10 @@ class ClientSettingsModal extends React.Component<{}, {}> {
Check for Updates
- +
diff --git a/src/util/util.ts b/src/util/util.ts index ca7766fb..252ba3c6 100644 --- a/src/util/util.ts +++ b/src/util/util.ts @@ -390,9 +390,12 @@ function getColorRGB(colorInput) { return computedColorStyle; } -function commandRtnHandler(prtn: Promise, errorMessage: OV) { +function commandRtnHandler(prtn: Promise, errorMessage: OV, onSuccess?: () => void) { prtn.then((crtn) => { if (crtn.success) { + if (onSuccess) { + onSuccess(); + } return; } mobx.action(() => {