feat: fix the bug that spin is always showing when response error (#1424)

This commit is contained in:
Yaodong Yu 2022-12-24 17:55:36 +08:00 committed by GitHub
parent 6ea73e3eca
commit 86ae97d1e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,7 @@ class CasLogout extends React.Component {
if (res.status === "ok") { if (res.status === "ok") {
Setting.showMessage("success", "Logged out successfully"); Setting.showMessage("success", "Logged out successfully");
this.props.onUpdateAccount(null); this.props.onUpdateAccount(null);
this.onUpdateApplication(null);
const redirectUri = res.data2; const redirectUri = res.data2;
if (redirectUri !== null && redirectUri !== undefined && redirectUri !== "") { if (redirectUri !== null && redirectUri !== undefined && redirectUri !== "") {
Setting.goToLink(redirectUri); Setting.goToLink(redirectUri);
@ -49,6 +50,7 @@ class CasLogout extends React.Component {
Setting.goToLinkSoft(this, `/cas/${this.state.owner}/${this.state.applicationName}/login`); Setting.goToLinkSoft(this, `/cas/${this.state.owner}/${this.state.applicationName}/login`);
} }
} else { } else {
this.onUpdateApplication(null);
Setting.showMessage("error", `Failed to log out: ${res.msg}`); Setting.showMessage("error", `Failed to log out: ${res.msg}`);
} }
}); });

View File

@ -102,6 +102,7 @@ class LoginPage extends React.Component {
}); });
} else { } else {
// Setting.showMessage("error", res.msg); // Setting.showMessage("error", res.msg);
this.onUpdateApplication(null);
this.setState({ this.setState({
application: res.data, application: res.data,
msg: res.msg, msg: res.msg,
@ -133,6 +134,7 @@ class LoginPage extends React.Component {
applicationName: res.data.name, applicationName: res.data.name,
}); });
} else { } else {
this.onUpdateApplication(null);
Setting.showMessage("error", res.msg); Setting.showMessage("error", res.msg);
} }
}); });