diff --git a/frontend/src/app/ui/user-profile/user-profile.component.ts b/frontend/src/app/ui/user-profile/user-profile.component.ts index 75e04949b..16a6d43f1 100644 --- a/frontend/src/app/ui/user-profile/user-profile.component.ts +++ b/frontend/src/app/ui/user-profile/user-profile.component.ts @@ -355,12 +355,13 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes } switchTenant(): void { - if (this.tenantFormGroup.valid === false) return; - const selectedTenant = this.tenantFormGroup.get('tenantCode').value; + + if (!this.tenantFormGroup.valid || !selectedTenant) return; - this.authService.selectedTenant(selectedTenant.value); - window.location.href = this.tenantHandlingService.getCurrentUrlEnrichedWithTenantCode(selectedTenant.value, true); + + this.authService.selectedTenant(selectedTenant); + window.location.href = this.tenantHandlingService.getCurrentUrlEnrichedWithTenantCode(selectedTenant, true); } //Preferences