Skip to content

Commit

Permalink
Merge pull request #830 from deepfence/ui-v2-dashboard-redirect
Browse files Browse the repository at this point in the history
add temporary  redirect for dashboard route
  • Loading branch information
manV authored Jan 19, 2023
2 parents 5a449da + b31ba9b commit 0869c14
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { LoaderFunction, redirect } from 'react-router-dom';

import storage from '@/utils/storage';

export const dashboardLoader: LoaderFunction = () => {
if (!storage.getAuth()) {
throw redirect('/auth/login');
}
throw redirect('/onboard');
};
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const OnboardAppHeader = () => {
className="m-auto"
/>
<Link
to="/dashboard"
to="/"
className={cx(
`${Typography.size.sm} `,
'underline underline-offset-2 ml-6 bg-transparent text-blue-600 dark:text-blue-500',
Expand Down
5 changes: 5 additions & 0 deletions deepfence_frontend/apps/dashboard/src/routes/private.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Outlet, RouteObject } from 'react-router-dom';

import { dashboardLoader } from '@/features/dashboard/loaders/dashboardLoader';
import {
ConnectorsLayout,
connectorsLoader,
Expand Down Expand Up @@ -100,4 +101,8 @@ export const privateRoutes: RouteObject[] = [
},
],
},
{
path: '/',
loader: dashboardLoader,
},
];

0 comments on commit 0869c14

Please sign in to comment.