Skip to content

Commit 4de99ba

Browse files
committed
Refactor condition
1 parent 6306776 commit 4de99ba

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,14 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
144144
distinctUntilChanged(),
145145
),
146146
]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => {
147-
for (const option of navOptions) {
148-
if (url?.split('?')[0].endsWith(`/${this.id}`)) {
149-
const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab);
150-
void this.router.navigate([option.routerLink], { queryParams: option.params });
151-
} else if (option.routerLink === url?.split('?')[0]) {
152-
this.currentOption$.next(option);
147+
if (url?.split('?')[0].endsWith(`/${this.id}`)) {
148+
const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab);
149+
void this.router.navigate([option.routerLink], { queryParams: option.params });
150+
} else {
151+
for (const option of navOptions) {
152+
if (option.routerLink === url?.split('?')[0]) {
153+
this.currentOption$.next(option);
154+
}
153155
}
154156
}
155157
}));

0 commit comments

Comments
 (0)