mirror of
https://github.com/MAKS-IT-COM/maksit-certs-ui.git
synced 2025-12-31 04:00:03 +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])
|
}, [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
|
||||||
: <></>
|
: <></>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user