From 96eee515902146e258e62c8795ac00c52107c08d Mon Sep 17 00:00:00 2001 From: Eugene Date: Fri, 25 Aug 2023 23:03:02 +0200 Subject: [PATCH] cleanup saving --- .../profilesSettingsTab.component.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tabby-settings/src/components/profilesSettingsTab.component.ts b/tabby-settings/src/components/profilesSettingsTab.component.ts index 9100a64c..58439ca0 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.ts +++ b/tabby-settings/src/components/profilesSettingsTab.component.ts @@ -88,7 +88,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent { const cfgProxy = this.profilesService.getConfigProxyForProfile(profile) profile.name = this.profilesService.providerForProfile(profile)?.getSuggestedName(cfgProxy) ?? this.translate.instant('{name} copy', base) } - this.profilesService.newProfile(profile).then(() => this.config.save()) + await this.profilesService.newProfile(profile) + await this.config.save() } async editProfile (profile: PartialProfile): Promise { @@ -97,7 +98,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent { return } Object.assign(profile, result) - await this.profilesService.writeProfile(profile).then(() => this.config.save()) + await this.profilesService.writeProfile(profile) + await this.config.save() } async showProfileEditModal (profile: PartialProfile): Promise|null> { @@ -140,7 +142,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent { cancelId: 1, }, )).response === 0) { - this.profilesService.deleteProfile(profile).then(() => this.config.save()) + await this.profilesService.deleteProfile(profile) + await this.config.save() } } @@ -149,7 +152,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent { modal.componentInstance.prompt = this.translate.instant('New group name') const result = await modal.result.catch(() => null) if (result?.value.trim()) { - await this.profilesService.newProfileGroup({ id: '', name: result.value }).then(() => this.config.save()) + await this.profilesService.newProfileGroup({ id: '', name: result.value }) + await this.config.save() } } @@ -159,7 +163,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent { return } Object.assign(group, result) - await this.profilesService.writeProfileGroup(ProfilesSettingsTabComponent.collapsableIntoPartialProfileGroup(group)).then(() => this.config.save()) + await this.profilesService.writeProfileGroup(ProfilesSettingsTabComponent.collapsableIntoPartialProfileGroup(group)) + await this.config.save() } async showProfileGroupEditModal (group: PartialProfileGroup): Promise|null> { @@ -239,7 +244,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent { deleteProfiles = true } - await this.profilesService.deleteProfileGroup(group, { deleteProfiles }).then(() => this.config.save()) + await this.profilesService.deleteProfileGroup(group, { deleteProfiles }) + await this.config.save() } }