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