redirect to login on auth:unauthorized event from AppContent
This commit is contained in:
@@ -83,6 +83,13 @@ const routerMapping = [
|
|||||||
function AppContent() {
|
function AppContent() {
|
||||||
const { authConfig } = useAppContext();
|
const { authConfig } = useAppContext();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
const handler = () => navigate("/login");
|
||||||
|
window.addEventListener("auth:unauthorized", handler);
|
||||||
|
return () => window.removeEventListener("auth:unauthorized", handler);
|
||||||
|
}, [navigate]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthProvider authConfig={authConfig}>
|
<AuthProvider authConfig={authConfig}>
|
||||||
<AppTheme>
|
<AppTheme>
|
||||||
|
|||||||
Reference in New Issue
Block a user