redirect on error

This commit is contained in:
Alex Holliday committed 2024-11-23 17:20:34 +08:00
1 parent 2732d5f64c
commit 4fd8d44012
1 file changed
+4
@@ -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);
}
};