Rework redirection using allOptions

This commit is contained in:
Abel Gómez
2025-03-13 23:38:56 +01:00
parent 262f758699
commit 5d4006f753

View File

@@ -148,7 +148,17 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
}));
if (this.router.url?.split('?')[0].endsWith(`/${this.id}`)) {
void this.router.navigate([this.router.url, this.appConfig[this.contentType].defaultBrowseTab]);
this.allOptions$.pipe(
take(1),
).subscribe((allOptions: ComColPageNavOption[]) => {
for (const option of allOptions) {
if (option.id === this.appConfig[this.contentType].defaultBrowseTab) {
this.currentOption$.next(option[0]);
void this.router.navigate([option.routerLink], { queryParams: option.params });
break;
}
}
});
}
}