Skip to content

Commit

Permalink
fix: reset admin page save button in catch (#3963)
Browse files Browse the repository at this point in the history
  • Loading branch information
YUCLing authored Sep 26, 2024
1 parent e43530e commit 80e70f4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion framework/core/js/src/admin/components/AdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,13 @@ export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAt
app.alerts.show({ type: 'success' }, app.translator.trans('core.admin.settings.saved_message'));
}

/**
* Called when `saveSettings` completes with errors.
*/
onsavefailed(): void {
this.loading = false;
}

/**
* Returns a function that fetches the setting from the `app` global.
*/
Expand Down Expand Up @@ -394,6 +401,6 @@ export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAt

this.loading = true;

return saveSettings(this.dirty()).then(this.onsaved.bind(this));
return saveSettings(this.dirty()).then(this.onsaved.bind(this)).catch(this.onsavefailed.bind(this));
}
}

0 comments on commit 80e70f4

Please sign in to comment.