feat: redirect to root in resistant not found
parent
3db267acef
commit
3baf4d1a2c
|
@ -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 (
|
||||
<>
|
||||
|
|
Loading…
Reference in New Issue