diff --git a/src/getResistantPageUrl.tsx b/src/getResistantPageUrl.tsx index 36aad9d..3131cdc 100644 --- a/src/getResistantPageUrl.tsx +++ b/src/getResistantPageUrl.tsx @@ -1,4 +1,5 @@ import { Resistant } from "./Resistant"; +import { getResistantsPageUrl } from "./getResistantsPageUrl"; export const getResistantPageUrl = (resistant: Resistant) => - `https://www.enfance-libre.fr/#/${resistant.id}`; + `${getResistantsPageUrl()}/#/${resistant.id}`; diff --git a/src/getResistantsPageUrl.tsx b/src/getResistantsPageUrl.tsx new file mode 100644 index 0000000..f9262a6 --- /dev/null +++ b/src/getResistantsPageUrl.tsx @@ -0,0 +1,2 @@ +export const getResistantsPageUrl = () => + `https://www.enfance-libre.fr/resistants`; diff --git a/src/routes/PageResistant.tsx b/src/routes/PageResistant.tsx index c6b782b..2f00fbe 100644 --- a/src/routes/PageResistant.tsx +++ b/src/routes/PageResistant.tsx @@ -1,6 +1,7 @@ import { redirect, useNavigate, useParams } from "react-router"; import { getResistantPhotoUrl } from "../getResistantPhotoUrl"; import { resistants } from "../resistants"; +import { getResistantsPageUrl } from "../getResistantsPageUrl"; export const PageResistant = () => { const { idResistant } = useParams(); @@ -9,7 +10,7 @@ export const PageResistant = () => { const resistant = resistants.find((r) => r.id === idResistant); if (!resistant) { - redirect("/"); + redirect(getResistantsPageUrl()); return <>RĂ©sistant introuvable; }