(refactor): Authorization component cleanup

This commit is contained in:
Maksym Sadovnychyy 2025-11-09 15:28:39 +01:00
parent 20ab94aa3e
commit b80fed3245
2 changed files with 3 additions and 5 deletions

View File

@ -28,13 +28,13 @@ const Authorization: FC<AuthorizationProps> = (props) => {
}, [dispatch]) }, [dispatch])
useEffect(() => { useEffect(() => {
if (!identity || isTokenExpired) { if (isTokenExpired) {
// Optionally, pass the current location for redirect after login // Optionally, pass the current location for redirect after login
navigate('/login', { replace: true, state: { from: location } }) navigate('/login', { replace: true, state: { from: location } })
} }
}, [identity, isTokenExpired, navigate, location]) }, [isTokenExpired, navigate, location])
return identity && !isTokenExpired return !isTokenExpired
? children ? children
: <></> : <></>
} }

View File

@ -138,8 +138,6 @@ const enrichStateWithJwtContent = (token: string, identity: Identity) => {
identity.acls = parseAclEntries(jwtAcls) identity.acls = parseAclEntries(jwtAcls)
} }
} }
console.log('Enriched identity:', identity)
} }
const identitySlice = createSlice({ const identitySlice = createSlice({