feat: redirect to root in resistant not found

proto-module-actu-react
Jalil Arfaoui 2023-05-13 23:13:51 +02:00
parent 3db267acef
commit 3baf4d1a2c
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { useNavigate, useParams } from "react-router";
import { redirect, useNavigate, useParams } from "react-router";
import { getResistantPhotoUrl } from "../getResistantPhotoUrl";
import { resistants } from "../resistants";
@ -8,7 +8,10 @@ export const PageResistant = () => {
const resistant = resistants.find((r) => r.id === idResistant);
if (!resistant) return <>Résistant introuvable</>;
if (!resistant) {
redirect("/");
return <>Résistant introuvable</>;
}
return (
<>