mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-19 16:03:02 +00:00
Refactor condition
This commit is contained in:
@@ -144,14 +144,16 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
|
|||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
),
|
),
|
||||||
]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => {
|
]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => {
|
||||||
for (const option of navOptions) {
|
|
||||||
if (url?.split('?')[0].endsWith(`/${this.id}`)) {
|
if (url?.split('?')[0].endsWith(`/${this.id}`)) {
|
||||||
const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab);
|
const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab);
|
||||||
void this.router.navigate([option.routerLink], { queryParams: option.params });
|
void this.router.navigate([option.routerLink], { queryParams: option.params });
|
||||||
} else if (option.routerLink === url?.split('?')[0]) {
|
} else {
|
||||||
|
for (const option of navOptions) {
|
||||||
|
if (option.routerLink === url?.split('?')[0]) {
|
||||||
this.currentOption$.next(option);
|
this.currentOption$.next(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user