fix: bad redirect in case of resistant not found

proto-module-actu-react
Jalil Arfaoui 2023-05-14 00:18:57 +02:00
parent 8b09312f2d
commit 11800ee2be
1 changed files with 2 additions and 2 deletions

View File

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