Skip to content
Snippets Groups Projects
Commit 4672727c authored by Marjolaine Bodin's avatar Marjolaine Bodin
Browse files

Resolve "Handle old data portal route"

parent 58091e4a
No related branches found
No related tags found
1 merge request!722Resolve "Handle old data portal route"
import { Loading } from '@edata-portal/core';
import { Loading, usePath } from '@edata-portal/core';
import React, { Suspense } from 'react';
import { InstrumentPage } from 'components/instrument/InstrumentPage';
import { RemoteComponent } from 'components/RemoteComponent';
import type { RouteObject } from 'react-router-dom';
import { Navigate, type RouteObject } from 'react-router-dom';
import { AdminPage } from 'components/admin/AdminPage';
import {
DatasetBreadcrumbItem,
......@@ -104,6 +104,12 @@ const DOIPage = React.lazy(() => import('components/doi/DOIPage'));
const DOIInfo = React.lazy(() => import('components/doi/DOIInfo'));
const DOIDatasets = React.lazy(() => import('components/doi/DOIDatasets'));
const PublicDOIRedirect = () => {
const doiPrefix = usePath('doiPrefix');
const doiSuffix = usePath('doiSuffix');
return <Navigate to={`/doi/${doiPrefix}/${doiSuffix}`} replace />;
};
export const routes: RouteObject[] = [
{
path: '/',
......@@ -532,7 +538,20 @@ export const routes: RouteObject[] = [
},
],
},
{
path: 'public',
children: [
{
index: true,
element: <NotFound />,
},
{
path: ':doiPrefix/:doiSuffix',
id: 'publicdoi',
element: <PublicDOIRedirect />,
},
],
},
{
path: '/addresses',
element: (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment