From d6a96221b28a04112fd3ae3847c4f04f5a2b5962 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed <99824146+ahmedfahim21@users.noreply.github.com> Date: Mon, 10 Mar 2025 02:03:56 +0530 Subject: [PATCH] fix: Configuration Wizard type error (#2313) --- .../core/shell/toolbar/toolbar.component.ts | 63 +++++++++++-------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/src/app/core/shell/toolbar/toolbar.component.ts b/src/app/core/shell/toolbar/toolbar.component.ts index 11e56f931..0c292ca1c 100644 --- a/src/app/core/shell/toolbar/toolbar.component.ts +++ b/src/app/core/shell/toolbar/toolbar.component.ts @@ -149,34 +149,43 @@ export class ToolbarComponent implements OnInit, AfterViewInit, AfterContentChec */ openDialog() { const configWizardRef = this.dialog.open(ConfigurationWizardComponent, {}); - configWizardRef.afterClosed().subscribe((response: { show: number }) => { - if (response.show === 1) { - this.configurationWizardService.showToolbar = true; - this.router.routeReuseStrategy.shouldReuseRoute = () => false; - this.router.onSameUrlNavigation = 'reload'; - this.router.navigate(['/home']); + + configWizardRef.afterClosed().subscribe((response: { show: number } | undefined) => { + if (!response) { + return; } - if (response.show === 2) { - this.configurationWizardService.showCreateOffice = true; - this.router.navigate(['/organization']); - } - if (response.show === 3) { - this.configurationWizardService.showDatatables = true; - this.router.navigate(['/system']); - } - if (response.show === 4) { - this.configurationWizardService.showChartofAccounts = true; - this.router.navigate(['/accounting']); - } - if (response.show === 5) { - this.configurationWizardService.showCharges = true; - this.router.navigate(['/products']); - } - if (response.show === 6) { - this.configurationWizardService.showManageFunds = true; - this.router.navigate(['/organization']); - } - if (response.show === 0) { + + switch (response.show) { + case 1: + this.configurationWizardService.showToolbar = true; + this.router.routeReuseStrategy.shouldReuseRoute = () => false; + this.router.onSameUrlNavigation = 'reload'; + this.router.navigate(['/home']); + break; + case 2: + this.configurationWizardService.showCreateOffice = true; + this.router.navigate(['/organization']); + break; + case 3: + this.configurationWizardService.showDatatables = true; + this.router.navigate(['/system']); + break; + case 4: + this.configurationWizardService.showChartofAccounts = true; + this.router.navigate(['/accounting']); + break; + case 5: + this.configurationWizardService.showCharges = true; + this.router.navigate(['/products']); + break; + case 6: + this.configurationWizardService.showManageFunds = true; + this.router.navigate(['/organization']); + break; + case 0: + break; + default: + break; } }); }