Skip to content

Commit

Permalink
improved the scopeToUrl function
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjeevLakhwani committed Dec 16, 2024
1 parent 4f49046 commit a00cecc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/js/components/Scope/DatasetScopePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Space direction="vertical" style={{ display: 'flex' }}>
Expand Down
6 changes: 3 additions & 3 deletions src/js/utils/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}
};

Expand Down

0 comments on commit a00cecc

Please sign in to comment.