redirect to login on auth:unauthorized event from AppContent

This commit is contained in:
2026-07-19 03:12:35 +05:30
parent 1a8f98d4a2
commit d2347de932

View File

@@ -83,6 +83,13 @@ const routerMapping = [
function AppContent() {
const { authConfig } = useAppContext();
const navigate = useNavigate();
React.useEffect(() => {
const handler = () => navigate("/login");
window.addEventListener("auth:unauthorized", handler);
return () => window.removeEventListener("auth:unauthorized", handler);
}, [navigate]);
return (
<AuthProvider authConfig={authConfig}>
<AppTheme>