From b80fed3245305b4e6795787fd962f98ddc75db8f Mon Sep 17 00:00:00 2001 From: Maksym Sadovnychyy Date: Sun, 9 Nov 2025 15:28:39 +0100 Subject: [PATCH] (refactor): Authorization component cleanup --- src/MaksIT.WebUI/src/components/Authorization.tsx | 6 +++--- src/MaksIT.WebUI/src/redux/slices/identitySlice.ts | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) 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({