implement config

This commit is contained in:
Alex Holliday committed 2025-02-05 10:57:28 -08:00
1 parent 73df0837bb
commit e9c7f1d7be
4 files changed
+52 -9

No files matched your search

@@ -37,7 +37,7 @@ const Controls = ({ deleteStatusPage, isDeleting }) => {
<Button
variant="contained"
color="secondary"
onClick={() => navigate(`/status/create`)}
onClick={() => navigate(`/status/configure`)}
sx={{
px: theme.spacing(5),
"& svg": {
@@ -28,7 +28,7 @@ const getMonitorWithPercentage = (monitor, theme) => {
};
};
const useStatusPageFetch = () => {
const useStatusPageFetch = (isCreate = false) => {
const [isLoading, setIsLoading] = useState(true);
const [networkError, setNetworkError] = useState(false);
const [statusPage, setStatusPage] = useState(undefined);
@@ -59,9 +59,13 @@ const useStatusPageFetch = () => {
setIsLoading(false);
}
}, [authToken, theme]);
useEffect(() => {
if (isCreate === true) {
return;
}
fetchStatusPage();
}, [fetchStatusPage]);
}, [isCreate, fetchStatusPage]);
return [statusPage, monitors, isLoading, networkError, fetchStatusPage];
};
+1 -3
View File
@@ -1,5 +1,5 @@
// Components
import { Typography, Stack, Box } from "@mui/material";
import { Typography, Stack } from "@mui/material";
import GenericFallback from "../../../Components/GenericFallback";
import Fallback from "../../../Components/Fallback";
import AdminLink from "./Components/AdminLink";
@@ -8,12 +8,10 @@ import SkeletonLayout from "./Components/Skeleton";
import StatusBar from "./Components/StatusBar";
import MonitorsList from "./Components/MonitorsList";
// Utils
import { useState, useEffect } from "react";
import { useStatusPageFetch } from "./Hooks/useStatusPageFetch";
import { useTheme } from "@emotion/react";
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
import { useLocation } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import { useStatusPageDelete } from "./Hooks/useStatusPageDelete";
const PublicStatus = () => {