mirror of
https://github.com/MAKS-IT-COM/maksit-certs-ui.git
synced 2025-12-30 19:50:07 +01:00
(refactor): Authorization component cleanup
This commit is contained in:
parent
20ab94aa3e
commit
b80fed3245
@ -28,13 +28,13 @@ const Authorization: FC<AuthorizationProps> = (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
|
||||
: <></>
|
||||
}
|
||||
|
||||
@ -138,8 +138,6 @@ const enrichStateWithJwtContent = (token: string, identity: Identity) => {
|
||||
identity.acls = parseAclEntries(jwtAcls)
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Enriched identity:', identity)
|
||||
}
|
||||
|
||||
const identitySlice = createSlice({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user