RED-6604: refactoring
This commit is contained in:
parent
b024e3ef0b
commit
cc90d9a561
@ -43,9 +43,7 @@ export class TenantsService {
|
||||
if (tenant) {
|
||||
this.#logger.info('[TENANTS] Tenant from route: ', tenant);
|
||||
if (await this.selectTenant(tenant)) {
|
||||
const intendedPath = window.location.pathname.replace(this.#baseHref, '');
|
||||
await this.#router.navigate([tenant], { skipLocationChange: true });
|
||||
await this.#router.navigateByUrl(intendedPath);
|
||||
await this.#executeMainResolverAndRedirect(tenant);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -56,7 +54,7 @@ export class TenantsService {
|
||||
this.#logger.info('[TENANTS] Only one tenant loaded, auto-select it and redirect to login page');
|
||||
const tenant = tenants[0].tenantId;
|
||||
if (await this.selectTenant(tenant)) {
|
||||
await this.#router.navigate([tenant]);
|
||||
await this.#executeMainResolverAndRedirect(tenant);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,4 +100,11 @@ export class TenantsService {
|
||||
this.#storageReference.removeItem(tenant + ':' + key);
|
||||
};
|
||||
}
|
||||
|
||||
async #executeMainResolverAndRedirect(tenant: string) {
|
||||
const intendedPath = window.location.pathname.replace(this.#baseHref, '');
|
||||
// TODO: Load roles in child routes canLoad functions so we can redirect straight to wanted URL
|
||||
await this.#router.navigate([tenant], { skipLocationChange: true });
|
||||
await this.#router.navigate([intendedPath]);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user