feat(web): soft-redirect to login on 401 via a navigate bridge (#48)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { useEffect } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { setNavigate } from "../api/auth-redirect";
|
||||
|
||||
/** Bridges React Router's navigate to the non-React 401 handler. Renders nothing. */
|
||||
export function NavigationBridge() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
setNavigate(navigate);
|
||||
return () => setNavigate(null);
|
||||
}, [navigate]);
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user