mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
Check the full URL rather than only the collection id to detect the default path
This commit is contained in:
@@ -131,6 +131,13 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
|
||||
}),
|
||||
);
|
||||
|
||||
let comColRoute: string;
|
||||
if (this.contentType === 'collection') {
|
||||
comColRoute = getCollectionPageRoute(this.id);
|
||||
} else if (this.contentType === 'community') {
|
||||
comColRoute = getCommunityPageRoute(this.id);
|
||||
}
|
||||
|
||||
this.subs.push(combineLatest([
|
||||
this.allOptions$,
|
||||
this.router.events.pipe(
|
||||
@@ -141,15 +148,17 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
|
||||
),
|
||||
]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => {
|
||||
for (const option of navOptions) {
|
||||
if (url?.split('?')[0].endsWith(`/${this.id}`) && option.id === this.appConfig[this.contentType].defaultBrowseTab) {
|
||||
if (url?.split('?')[0] === comColRoute && option.id === this.appConfig[this.contentType].defaultBrowseTab) {
|
||||
void this.router.navigate([option.routerLink], { queryParams: option.params });
|
||||
break;
|
||||
} else if (option.routerLink === url?.split('?')[0]) {
|
||||
this.currentOption$.next(option);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
if (this.router.url?.split('?')[0].endsWith(`/${this.id}`)) {
|
||||
if (this.router.url?.split('?')[0] === comColRoute) {
|
||||
this.allOptions$.pipe(
|
||||
take(1),
|
||||
).subscribe((allOptions: ComColPageNavOption[]) => {
|
||||
|
Reference in New Issue
Block a user