Skip to content

Commit

Permalink
Proper redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
nerik committed Sep 22, 2023
1 parent 94202b2 commit 5a22094
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/scripts/redirects.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import { Navigate, Route, useParams } from 'react-router';

import { STORIES_PATH } from '$utils/routes';
import { DATASETS_PATH, STORIES_PATH } from '$utils/routes';
import { useDataset } from '$utils/veda-data';
import DatasetsOverview from '$components/datasets/s-overview';
import DatasetsExplore from '$components/datasets/s-explore';

function DiscoveryRedirect() {
Expand Down Expand Up @@ -58,5 +57,10 @@ export const discoveryRoutes = (

export function DatasetExploreRedirect() {
const dataset = useDataset();
return dataset?.data.disableExplore ? <DatasetsOverview /> : <DatasetsExplore />;
const url = `${DATASETS_PATH}/${dataset?.data.id}`;
return dataset?.data.disableExplore ? (
<Navigate replace to={url} />
) : (
<DatasetsExplore />
);
}

0 comments on commit 5a22094

Please sign in to comment.