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 PublicLayout from 'components/PublicLayout';
|
||||
import Applications from 'pages/Applications';
|
||||
@@ -17,9 +17,13 @@ import * as URLS from 'config/urls';
|
||||
import settingsRoutes from './settingsRoutes';
|
||||
import adminSettingsRoutes from './adminSettingsRoutes';
|
||||
import Notifications from 'pages/Notifications';
|
||||
import useAuthentication from 'hooks/useAuthentication';
|
||||
|
||||
export default (
|
||||
<Routes>
|
||||
function Routes() {
|
||||
const { isAuthenticated } = useAuthentication();
|
||||
|
||||
return (
|
||||
<ReactRouterRoutes>
|
||||
<Route
|
||||
path={URLS.EXECUTIONS}
|
||||
element={
|
||||
@@ -85,10 +89,7 @@ export default (
|
||||
}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path={URLS.LOGIN_CALLBACK}
|
||||
element={<LoginCallback />}
|
||||
/>
|
||||
<Route path={URLS.LOGIN_CALLBACK} element={<LoginCallback />} />
|
||||
|
||||
<Route
|
||||
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>
|
||||
|
||||
@@ -139,5 +145,8 @@ export default (
|
||||
</Layout>
|
||||
}
|
||||
/>
|
||||
</Routes>
|
||||
</ReactRouterRoutes>
|
||||
);
|
||||
}
|
||||
|
||||
export default <Routes />;
|
||||
|
Reference in New Issue
Block a user