RED-6713: remove username from query params
This commit is contained in:
parent
a5368f2957
commit
1aad88e2d0
@ -1,17 +1,18 @@
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { UserService } from '@users/user.service';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
import { NavigationStart, Router } from '@angular/router';
|
||||
import { ActivatedRoute, NavigationStart, ParamMap, Router } from '@angular/router';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { SpotlightSearchAction } from '@components/spotlight-search/spotlight-search-action';
|
||||
import { filter, map, startWith } from 'rxjs/operators';
|
||||
import { BASE_HREF, IqserPermissionsService, List, shareDistinctLast, TenantsService } from '@iqser/common-ui';
|
||||
import { IqserPermissionsService, List, shareDistinctLast, TenantsService } from '@iqser/common-ui';
|
||||
import { BreadcrumbsService } from '@services/breadcrumbs.service';
|
||||
import { FeaturesService } from '@services/features.service';
|
||||
import { ARCHIVE_ROUTE, DOSSIERS_ARCHIVE, DOSSIERS_ROUTE } from '@red/domain';
|
||||
import { ROLES } from '@users/roles';
|
||||
import { REDDocumentViewer } from '../../modules/pdf-viewer/services/document-viewer.service';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
const isNavigationStart = event => event instanceof NavigationStart;
|
||||
const isSearchScreen: (url: string) => boolean = url => url.includes('/search');
|
||||
@ -43,7 +44,6 @@ export class BaseScreenComponent {
|
||||
action: (query): void => this.#search(query, []),
|
||||
},
|
||||
];
|
||||
readonly #baseHref = inject(BASE_HREF);
|
||||
readonly #navigationStart$ = this._router.events.pipe(
|
||||
filter(isNavigationStart),
|
||||
map((event: NavigationStart) => event.url),
|
||||
@ -54,6 +54,7 @@ export class BaseScreenComponent {
|
||||
|
||||
constructor(
|
||||
private readonly _router: Router,
|
||||
activatedRoute: ActivatedRoute,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _featuresService: FeaturesService,
|
||||
protected readonly _tenantsService: TenantsService,
|
||||
@ -62,7 +63,10 @@ export class BaseScreenComponent {
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
readonly titleService: Title,
|
||||
readonly breadcrumbsService: BreadcrumbsService,
|
||||
) {}
|
||||
) {
|
||||
// eslint-disable-next-line rxjs/no-ignored-subscription
|
||||
activatedRoute.queryParamMap.pipe(takeUntilDestroyed()).subscribe(queryParams => this.#navigate(queryParams));
|
||||
}
|
||||
|
||||
get #hideSearchThisDossier() {
|
||||
const routerLink = this.breadcrumbsService.breadcrumbs[1]?.options?.routerLink;
|
||||
@ -74,6 +78,17 @@ export class BaseScreenComponent {
|
||||
return !isDossierOverview;
|
||||
}
|
||||
|
||||
#navigate(queryParams: ParamMap) {
|
||||
if (queryParams.has('username')) {
|
||||
return this._router.navigate([], {
|
||||
queryParams: {
|
||||
username: null,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#search(query: string, dossierIds: string[], onlyActive = false) {
|
||||
const queryParams = { query, dossierIds: dossierIds.join(','), onlyActive };
|
||||
this._router.navigate([`/${this._tenantsService.activeTenantId}/main/search`], { queryParams }).then();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user