From 4fd8d440127606bbc67f051036ba1bd6c58d6ebc Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Sat, 23 Nov 2024 17:20:34 +0800 Subject: [PATCH] redirect on error --- Client/src/Pages/Infrastructure/Details/index.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Client/src/Pages/Infrastructure/Details/index.jsx b/Client/src/Pages/Infrastructure/Details/index.jsx index f9c8dbe1f..6730ed7ec 100644 --- a/Client/src/Pages/Infrastructure/Details/index.jsx +++ b/Client/src/Pages/Infrastructure/Details/index.jsx @@ -9,6 +9,7 @@ import { useSelector } from "react-redux"; import { networkService } from "../../../main"; import PulseDot from "../../../Components/Animated/PulseDot"; import useUtils from "../../Monitors/utils"; +import { useNavigate } from "react-router-dom"; import Empty from "./empty"; import { formatDurationRounded, formatDurationSplit } from "../../../Utils/timeUtils"; import { @@ -163,6 +164,7 @@ GaugeBox.propTypes = { * @returns {React.ReactElement} Infrastructure details page component */ const InfrastructureDetails = () => { + const navigate = useNavigate(); const theme = useTheme(); const { monitorId } = useParams(); const navList = [ @@ -200,6 +202,8 @@ const InfrastructureDetails = () => { setMonitor(response.data.data); } catch (error) { + navigate("/not-found", { replace: true }); + console.error(error); } };