From 5a22094e7e2bad2be55b673215db8acccdf921fa Mon Sep 17 00:00:00 2001 From: Erik Escoffier <me@erik.nz> Date: Fri, 22 Sep 2023 09:45:25 +0200 Subject: [PATCH] Proper redirect --- app/scripts/redirects.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/scripts/redirects.tsx b/app/scripts/redirects.tsx index f6649346a..e1d6d6e2a 100644 --- a/app/scripts/redirects.tsx +++ b/app/scripts/redirects.tsx @@ -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() { @@ -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 /> + ); }