fix: reset save button state on failure in admin page (#4010)

This commit is contained in:
2024-09-20 15:28:45 +08:00 committed by GitHub
parent f13a1c8387
commit aafc615d67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.
*/
@ -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> {