Skip to content

Commit

Permalink
Merged in DSC-1486-item-page-resolver-maintenance (pull request DSpac…
Browse files Browse the repository at this point in the history
…e#1298)

[DSC-1486] feature: added check to main tab

Approved-by: Andrea Barbasso
Approved-by: Giuseppe Digilio
  • Loading branch information
vNovski authored and atarix83 committed Feb 9, 2024
2 parents 0a0227f + 8393cc9 commit 8c1700d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/item-page/cris-item-page-tab.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export class CrisItemPageTabResolver implements Resolve<RemoteData<PaginatedList
const givenTab = urlSplit[1];
const itemPageRoute = getItemPageRoute(itemRD.payload);
const isValidTab = tabsRD.payload.page.some((tab) => !givenTab || `/${tab.shortname}` === givenTab);
const mainTab = tabsRD.payload.page.filter((tab) => !tab.leading)[0];

const mainTab = tabsRD.payload.page.length === 1
? tabsRD.payload.page[0]
: tabsRD.payload.page.find(tab => !tab.leading);

if (!isValidTab) {
// If wrong tab is given redirect to 404 page
this.router.navigateByUrl(getPageNotFoundRoute(), { skipLocationChange: true, replaceUrl: false });
Expand Down

0 comments on commit 8c1700d

Please sign in to comment.