if user don't have new app_roles redirect to login
- fix app preview
This commit is contained in:
parent
79ec69a8f2
commit
f0439dba40
3 changed files with 9 additions and 4 deletions
|
|
@ -10,7 +10,9 @@ import { LoginCallback } from './modules/login/LoginCallback';
|
|||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function App() {
|
||||
const { authToken } = useAuth();
|
||||
const { authToken, currentUser } = useAuth();
|
||||
|
||||
const redirectToLogin = !authToken || !currentUser?.app_roles;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -26,7 +28,7 @@ function App() {
|
|||
</Helmet>
|
||||
|
||||
<div className="app bg-gray-50 min-h-screen flex flex-col">
|
||||
{!authToken ? (
|
||||
{redirectToLogin ? (
|
||||
<Routes>
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route path="/login-callback" element={<LoginCallback />} />
|
||||
|
|
|
|||
Reference in a new issue