diff --git a/Client/src/Pages/DistributedUptime/Status/index.jsx b/Client/src/Pages/DistributedUptime/Status/index.jsx index 7297d83e2..d91761e06 100644 --- a/Client/src/Pages/DistributedUptime/Status/index.jsx +++ b/Client/src/Pages/DistributedUptime/Status/index.jsx @@ -16,7 +16,6 @@ import SkeletonLayout from "./Components/Skeleton"; import { useTheme } from "@mui/material/styles"; import { useState } from "react"; import { useParams } from "react-router-dom"; -import { useIsAdmin } from "../../../Hooks/useIsAdmin"; import { useSubscribeToDetails } from "../Details/Hooks/useSubscribeToDetails"; import { useStatusPageFetchByUrl } from "./Hooks/useStatusPageFetchByUrl"; import { useStatusPageDelete } from "../../StatusPage/Status/Hooks/useStatusPageDelete"; @@ -33,13 +32,18 @@ const DistributedUptimeStatus = () => { // Utils const theme = useTheme(); const navigate = useNavigate(); - const [statusPageIsLoading, statusPageNetworkError, statusPage, monitorId] = - useStatusPageFetchByUrl({ - url, - }); + const [ + statusPageIsLoading, + statusPageNetworkError, + statusPage, + monitorId, + isPublished, + ] = useStatusPageFetchByUrl({ + url, + }); const [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger] = - useSubscribeToDetails({ monitorId, dateRange }); + useSubscribeToDetails({ monitorId, dateRange, isPublic, isPublished }); const [deleteStatusPage, isDeleting] = useStatusPageDelete(() => { navigate("/distributed-uptime"); @@ -61,6 +65,35 @@ const DistributedUptimeStatus = () => { }; } + // Done loading, a status page doesn't exist + if (!statusPageIsLoading && typeof statusPage === "undefined") { + return ( + + + + A public status page is not set up. + + Please contact to your administrator + + + ); + } + + // Done loading, a status page exists but is not public + if (!statusPageIsLoading && statusPage.isPublished === false) { + return ( + + + This status page is not public. + + + ); + } + if (isLoading || statusPageIsLoading) { return ; }