early return if status page public and not published

This commit is contained in:
Alex Holliday committed 2025-02-08 08:05:42 -08:00
1 parent 1fabf918c3
commit 2f1f2d1a3f
3 files changed
+12 -6

No files matched your search

@@ -8,6 +8,7 @@ const useStatusPageFetchByUrl = ({ url }) => {
const [networkError, setNetworkError] = useState(false);
const [statusPage, setStatusPage] = useState(undefined);
const [monitorId, setMonitorId] = useState(undefined);
const [isPublished, setIsPublished] = useState(false);
const { authToken } = useSelector((state) => state.auth);
useEffect(() => {
const fetchStatusPageByUrl = async () => {
@@ -17,6 +18,7 @@ const useStatusPageFetchByUrl = ({ url }) => {
const statusPage = response.data.data;
setStatusPage(statusPage);
setMonitorId(statusPage?.monitors[0]);
setIsPublished(statusPage?.isPublished);
} catch (error) {
setNetworkError(true);
createToast({
@@ -29,7 +31,7 @@ const useStatusPageFetchByUrl = ({ url }) => {
fetchStatusPageByUrl();
}, [authToken, url]);
return [isLoading, networkError, statusPage, monitorId];
return [isLoading, networkError, statusPage, monitorId, isPublished];
};
export { useStatusPageFetchByUrl };