1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

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

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> {