diff --git a/src/MaksIT.WebUI/src/components/Authorization.tsx b/src/MaksIT.WebUI/src/components/Authorization.tsx index 58cab88..a393c64 100644 --- a/src/MaksIT.WebUI/src/components/Authorization.tsx +++ b/src/MaksIT.WebUI/src/components/Authorization.tsx @@ -28,13 +28,13 @@ const Authorization: FC = (props) => { }, [dispatch]) useEffect(() => { - if (!identity || isTokenExpired) { + if (isTokenExpired) { // Optionally, pass the current location for redirect after login navigate('/login', { replace: true, state: { from: location } }) } - }, [identity, isTokenExpired, navigate, location]) + }, [isTokenExpired, navigate, location]) - return identity && !isTokenExpired + return !isTokenExpired ? children : <> } diff --git a/src/MaksIT.WebUI/src/redux/slices/identitySlice.ts b/src/MaksIT.WebUI/src/redux/slices/identitySlice.ts index 6dae1db..aa0080e 100644 --- a/src/MaksIT.WebUI/src/redux/slices/identitySlice.ts +++ b/src/MaksIT.WebUI/src/redux/slices/identitySlice.ts @@ -138,8 +138,6 @@ const enrichStateWithJwtContent = (token: string, identity: Identity) => { identity.acls = parseAclEntries(jwtAcls) } } - - console.log('Enriched identity:', identity) } const identitySlice = createSlice({