Skip to content

Commit

Permalink
fix: reset save button state on failure in admin page (#4010)
Browse files Browse the repository at this point in the history
  • Loading branch information
YUCLing authored Sep 20, 2024
1 parent f13a1c8 commit aafc615
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion framework/core/js/src/admin/components/AdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,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` fails to complete.
*/
onsavefailed(): void {
this.loading = false;
}

/**
* Returns a function that fetches the setting from the `app` global.
*/
Expand Down Expand Up @@ -232,7 +239,8 @@ export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAt
app.modal.show(LoadingModal);
window.location.reload();
}
});
})
.catch(this.onsavefailed.bind(this));
}

modelLocale(): Record<string, string> {
Expand Down

0 comments on commit aafc615

Please sign in to comment.