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

fix: reset admin page save button in catch (#3963)

This commit is contained in:
2024-09-27 02:07:35 +08:00
committed by GitHub
parent e43530e40a
commit 80e70f4980

View File

@@ -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.
*/
@@ -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));
}
}