From a00cecc57472f9f8d7a538a38d62a2cbb4fa5ade Mon Sep 17 00:00:00 2001 From: SanjeevLakhwani Date: Sun, 15 Dec 2024 22:43:53 -0500 Subject: [PATCH] improved the scopeToUrl function --- src/js/components/Scope/DatasetScopePicker.tsx | 2 +- src/js/utils/router.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/components/Scope/DatasetScopePicker.tsx b/src/js/components/Scope/DatasetScopePicker.tsx index c70bcc94..48b9ec5a 100644 --- a/src/js/components/Scope/DatasetScopePicker.tsx +++ b/src/js/components/Scope/DatasetScopePicker.tsx @@ -31,7 +31,7 @@ const DatasetScopePicker = ({ parentProject }: DatasetScopePickerProps) => { const showSelectProject = !selectedScope.fixedProject && parentProject.identifier != scopeObj.project; const parentProjectScope: DiscoveryScope = { project: parentProject.identifier }; - const projectURL = scopeToUrl(parentProjectScope, baseURL, `/${page}`); + const projectURL = scopeToUrl(parentProjectScope, baseURL, page); return ( diff --git a/src/js/utils/router.ts b/src/js/utils/router.ts index fb098e30..ab952439 100644 --- a/src/js/utils/router.ts +++ b/src/js/utils/router.ts @@ -52,11 +52,11 @@ export const validProjectDataset = (projects: Project[], unvalidatedScope: Disco export const scopeToUrl = (scope: DiscoveryScope, prefix: string = '', suffix: string = ''): string => { if (scope.project && scope.dataset) { - return `${prefix}/p/${scope.project}/d/${scope.dataset}${suffix}`; + return `${prefix}/p/${scope.project}/d/${scope.dataset}/${suffix}`; } else if (scope.project) { - return `${prefix}/p/${scope.project}${suffix}`; + return `${prefix}/p/${scope.project}/${suffix}`; } else { - return `${prefix}${suffix}`; + return `${prefix}/${suffix}`; } };