Skip to content

Commit

Permalink
Refactor condition
Browse files Browse the repository at this point in the history
  • Loading branch information
abelgomez committed Jul 4, 2024
1 parent dac445a commit d96fee8
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
distinctUntilChanged(),
),
]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => {
for (const option of navOptions) {
if (url?.split('?')[0].endsWith(`/${this.id}`)) {
const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab);
void this.router.navigate([option.routerLink], { queryParams: option.params });
} else if (option.routerLink === url?.split('?')[0]) {
this.currentOption$.next(option);
if (url?.split('?')[0].endsWith(`/${this.id}`)) {
const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab);
void this.router.navigate([option.routerLink], { queryParams: option.params });
} else {
for (const option of navOptions) {
if (option.routerLink === url?.split('?')[0]) {
this.currentOption$.next(option);
}
}
}
}));
Expand Down

0 comments on commit d96fee8

Please sign in to comment.