Immediately hide modal when deleting workspace (#187)

* immediately hide modal when deleting workspace

* only pop modal when purging is successful
This commit is contained in:
Red J Adaya 2023-12-24 04:31:11 +08:00 committed by GitHub
parent de9c029ba8
commit 019eaecdaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -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<{}, {}> {
<div className="settings-field">
<div className="settings-label">Check for Updates</div>
<div className="settings-input">
<Toggle checked={!cdata.clientopts.noreleasecheck} onChange={this.handleChangeReleaseCheck} />
<Toggle
checked={!cdata.clientopts.noreleasecheck}
onChange={this.handleChangeReleaseCheck}
/>
</div>
</div>
<div className="settings-field">

View File

@ -390,9 +390,12 @@ function getColorRGB(colorInput) {
return computedColorStyle;
}
function commandRtnHandler(prtn: Promise<CommandRtnType>, errorMessage: OV<string>) {
function commandRtnHandler(prtn: Promise<CommandRtnType>, errorMessage: OV<string>, onSuccess?: () => void) {
prtn.then((crtn) => {
if (crtn.success) {
if (onSuccess) {
onSuccess();
}
return;
}
mobx.action(() => {