fix: status is broken

fix: status is broken
This commit is contained in:
dvelo 2025-02-06 19:16:52 -06:00 committed by GitHub
commit 45fcc618c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -31,15 +31,15 @@ import { NextApiRequest, NextApiResponse } from "next";
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
res: NextApiResponse,
) {
const betterStackResult = await fetch(
`https://uptime.betterstack.com/api/v2/status-pages/${process.env.BS_STATUS_PAGE}/status-reports`,
{ headers: { Authorization: `Bearer ${process.env.BS_TOKEN}` } }
{ headers: { Authorization: `Bearer ${process.env.BS_TOKEN}` } },
);
const betterStackURL = await fetch(
`https://uptime.betterstack.com/api/v2/status-pages/${process.env.BS_STATUS_PAGE}`,
{ headers: { Authorization: `Bearer ${process.env.BS_TOKEN}` } }
{ headers: { Authorization: `Bearer ${process.env.BS_TOKEN}` } },
);
const result = await betterStackResult.json();
@ -50,8 +50,9 @@ export default async function handler(
c.attributes.ends_at === null &&
c.attributes.affected_resources.filter(
(v: any) =>
v.status_page_resource_id === process.env.BS_STATUS_MAIN_WEBSITE
).length > 0
v.status_page_resource_id === process.env.BS_STATUS_MAIN_WEBSITE &&
v.status !== "resolved",
).length > 0,
);
res.status(200).send({