fix: resolve CORS issue on public status pages and handle UI errors

This commit is contained in:
nikhil2004 committed 2026-09-22 22:06:38 +05:30
1 parent 9434cd8929
commit 780ed8147b
2 files changed
+20 -2

No files matched your search

@@ -38,7 +38,7 @@ export const IncidentModal = ({
const { t } = useTranslation();
const open = Boolean(monitorId && date);
const { data, isLoading } = useGet<{ incidents: Incident[] }>(
const { data, isLoading, error } = useGet<{ incidents: Incident[] }>(
open ? `/status-page/${url}/incidents/${monitorId}?date=${date}` : null,
{},
{ revalidateOnFocus: false }
@@ -68,6 +68,16 @@ export const IncidentModal = ({
<Typography mt={SPACING.SM}>
{t("pages.statusPages.monitorsList.incidents.loading")}
</Typography>
) : error ? (
<Typography
mt={SPACING.SM}
color="error"
>
{t(
"pages.statusPages.monitorsList.incidents.errorLoading",
"Failed to load incidents."
)}
</Typography>
) : data?.incidents && data.incidents.length > 0 ? (
<Stack
gap={SPACING.LG}
@@ -16,7 +16,15 @@ export const isPublicStatusPageApiPath = (method: string, path: string): boolean
return true;
}
if (!slug || slug === "team" || slug.includes("/")) {
if (!slug || slug === "team") {
return false;
}
if (slug.includes("/")) {
const parts = slug.split("/");
if (parts.length === 3 && parts[1] === "incidents") {
return true;
}
return false;
}