diff --git a/src/routes/PageResistant.tsx b/src/routes/PageResistant.tsx index 7bf1efa..532ea55 100644 --- a/src/routes/PageResistant.tsx +++ b/src/routes/PageResistant.tsx @@ -1,11 +1,14 @@ +import { useContext } from "react"; import { useNavigate, useParams } from "react-router"; import { getResistantPhotoUrl } from "../getResistantPhotoUrl"; import { resistants } from "../resistants"; import { getResistantsPageUrl } from "../getResistantsPageUrl"; +import { HomeContext } from "../context/HomeContext"; export const PageResistant = () => { const { idResistant } = useParams(); const navigate = useNavigate(); + const { isHome } = useContext(HomeContext); const resistant = resistants.find((r) => r.id === idResistant); @@ -14,6 +17,11 @@ export const PageResistant = () => { return <>RĂ©sistant introuvable; } + if (isHome) { + window.location.assign(getResistantsPageUrl()); + return null; + } + return ( <>