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:
Trần Thanh Tịnh
2023-06-27 20:33:47 +07:00
committed by GitHub
parent 0a8c2a35fe
commit cd7589775c
60 changed files with 416 additions and 155 deletions

View File

@ -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,