mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-05 14:09:57 +08:00
feat: replace all panic by response err (#1993)
* fix: missing return after response error * feat: handle error in frontend * feat: disable loading and catch org edit error * chore: i18 for error message * chore: remove break line * feat: application catching error
This commit is contained in:
@ -64,6 +64,11 @@ class PricingPage extends React.Component {
|
||||
|
||||
Promise.all(plans)
|
||||
.then(results => {
|
||||
const hasError = results.some(result => result.status === "error");
|
||||
if (hasError) {
|
||||
Setting.showMessage("error", `${i18next.t("Failed to get plans")}`);
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
plans: results,
|
||||
loading: false,
|
||||
@ -81,6 +86,11 @@ class PricingPage extends React.Component {
|
||||
|
||||
PricingBackend.getPricing(this.state.owner, pricingName)
|
||||
.then((result) => {
|
||||
if (result.status === "error") {
|
||||
Setting.showMessage("error", result.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
loading: false,
|
||||
pricing: result,
|
||||
|
Reference in New Issue
Block a user