fixes
This commit is contained in:
parent
b7afdb59ad
commit
7bd2608cb4
|
@ -188,7 +188,7 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||
.subscribe((event: NavigationStart) => {
|
||||
const enrichedUrl = this.tenantHandlingService.getUrlEnrichedWithTenantCode(event.url, this.authentication.selectedTenant() ?? 'default');
|
||||
if (event.url != enrichedUrl) {
|
||||
this.router.navigate([enrichedUrl]);
|
||||
this.router.navigateByUrl(enrichedUrl);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { DOCUMENT, LocationStrategy } from '@angular/common';
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
import { PRIMARY_OUTLET, Router, UrlSegment, UrlSegmentGroup, UrlTree } from '@angular/router';
|
||||
import { PRIMARY_OUTLET, Router, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree } from '@angular/router';
|
||||
|
||||
@Injectable()
|
||||
export class TenantHandlingService {
|
||||
|
@ -9,6 +9,7 @@ export class TenantHandlingService {
|
|||
@Inject(DOCUMENT) private readonly document: Document,
|
||||
private readonly locationStrategy: LocationStrategy,
|
||||
private readonly router: Router,
|
||||
private urlSerializer: UrlSerializer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -25,16 +26,16 @@ export class TenantHandlingService {
|
|||
|
||||
getCurrentUrlEnrichedWithTenantCode(tenantCode: string, withOrigin: boolean) {
|
||||
const path = this.getUrlEnrichedWithTenantCode(this.router.routerState.snapshot.url, tenantCode)
|
||||
return withOrigin ? this.getBaseUrl() + path.substring(1) : path;
|
||||
return withOrigin ? this.getBaseUrl() + path.toString().substring(1) : path;
|
||||
}
|
||||
|
||||
getUrlEnrichedWithTenantCode(url: string, tenantCode: string) {
|
||||
getUrlEnrichedWithTenantCode(url: string, tenantCode: string): string {
|
||||
|
||||
const urlTree: UrlTree = this.router.parseUrl(url);
|
||||
const urlSegmentGroup: UrlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
||||
const urlSegments: UrlSegment[] = urlSegmentGroup.segments;
|
||||
const urlSegments: UrlSegment[] = urlSegmentGroup?.segments;
|
||||
|
||||
const tenantParamIndex = urlSegments.findIndex(x => x.path == 't');
|
||||
const tenantParamIndex = urlSegments?.findIndex(x => x.path == 't');
|
||||
if (tenantParamIndex >= 0) {
|
||||
|
||||
if (tenantCode == 'default') {
|
||||
|
@ -49,7 +50,7 @@ export class TenantHandlingService {
|
|||
}
|
||||
}
|
||||
|
||||
return urlTree.toString();
|
||||
return this.urlSerializer.serialize(urlTree);
|
||||
}
|
||||
|
||||
getBaseUrl(): string {
|
||||
|
|
|
@ -173,7 +173,7 @@ export class HybridListingComponent extends BaseComponent implements OnInit, OnC
|
|||
this.resizeObserver?.unobserve(this.wrapperCard.nativeElement)
|
||||
this.resizeObserver?.disconnect();
|
||||
this.resizeObserver = null;
|
||||
this.resizeSubject$.complete();
|
||||
this.resizeSubject$?.complete();
|
||||
}
|
||||
|
||||
private resizeObserver: ResizeObserver;
|
||||
|
|
Loading…
Reference in New Issue