feat: Show /login directly on / without valid authentication (#1528)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Route, Routes, Navigate } from 'react-router-dom';
|
import { Route, Routes as ReactRouterRoutes, Navigate } from 'react-router-dom';
|
||||||
import Layout from 'components/Layout';
|
import Layout from 'components/Layout';
|
||||||
import PublicLayout from 'components/PublicLayout';
|
import PublicLayout from 'components/PublicLayout';
|
||||||
import Applications from 'pages/Applications';
|
import Applications from 'pages/Applications';
|
||||||
@@ -17,9 +17,13 @@ import * as URLS from 'config/urls';
|
|||||||
import settingsRoutes from './settingsRoutes';
|
import settingsRoutes from './settingsRoutes';
|
||||||
import adminSettingsRoutes from './adminSettingsRoutes';
|
import adminSettingsRoutes from './adminSettingsRoutes';
|
||||||
import Notifications from 'pages/Notifications';
|
import Notifications from 'pages/Notifications';
|
||||||
|
import useAuthentication from 'hooks/useAuthentication';
|
||||||
|
|
||||||
export default (
|
function Routes() {
|
||||||
<Routes>
|
const { isAuthenticated } = useAuthentication();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ReactRouterRoutes>
|
||||||
<Route
|
<Route
|
||||||
path={URLS.EXECUTIONS}
|
path={URLS.EXECUTIONS}
|
||||||
element={
|
element={
|
||||||
@@ -85,10 +89,7 @@ export default (
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route path={URLS.LOGIN_CALLBACK} element={<LoginCallback />} />
|
||||||
path={URLS.LOGIN_CALLBACK}
|
|
||||||
element={<LoginCallback />}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path={URLS.SIGNUP}
|
path={URLS.SIGNUP}
|
||||||
@@ -126,7 +127,12 @@ export default (
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route path="/" element={<Navigate to={URLS.FLOWS} replace />} />
|
<Route
|
||||||
|
path="/"
|
||||||
|
element={
|
||||||
|
<Navigate to={isAuthenticated ? URLS.FLOWS : URLS.LOGIN} replace />
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<Route path={URLS.SETTINGS}>{settingsRoutes}</Route>
|
<Route path={URLS.SETTINGS}>{settingsRoutes}</Route>
|
||||||
|
|
||||||
@@ -139,5 +145,8 @@ export default (
|
|||||||
</Layout>
|
</Layout>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Routes>
|
</ReactRouterRoutes>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default <Routes />;
|
||||||
|
Reference in New Issue
Block a user