Fix notify for all posts switch field loading state (#3938)

This commit is contained in:
Ngô Quốc Đạt 2024-01-19 18:04:25 +07:00 committed by GitHub
parent e3350543af
commit 1aa7806244
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,8 +29,14 @@ export default function () {
id="flarum_subscriptions__notify_for_all_posts"
state={!!this.user!.preferences()?.['flarum-subscriptions.notify_for_all_posts']}
onchange={(val: boolean) => {
this.user!.savePreferences({ 'flarum-subscriptions.notify_for_all_posts': val });
this.notifyForAllPostsLoading = true;
this.user!.savePreferences({ 'flarum-subscriptions.notify_for_all_posts': val }).then(() => {
this.notifyForAllPostsLoading = false;
m.redraw();
});
}}
loading={this.notifyForAllPostsLoading}
>
{app.translator.trans('flarum-subscriptions.forum.settings.notify_for_all_posts_label')}
</Switch>