Linted and Production Ready

This commit is contained in:
Nicholas Pease 2023-03-01 02:56:53 +00:00
parent b4680e4b8c
commit efe9ea3a60
2 changed files with 6 additions and 7 deletions

View File

@ -8,7 +8,7 @@ export default function Component({ service }) {
const { widget } = service; const { widget } = service;
const { data: isUp} = useWidgetAPI(widget); const { data: isUp} = useWidgetAPI(widget);
const { t } = useTranslation(); const { t } = useTranslation();
let upIndicator;
if (!isUp) { if (!isUp) {
return ( return (
@ -17,11 +17,10 @@ export default function Component({ service }) {
</Container> </Container>
); );
} }
var upIndicator; if (isUp.data.includes("Up")) upIndicator = <span className="text-green-500">{t("uptimekumamonitor.up")}</span>
if (isUp.data.includes("Up")) {upIndicator = <span className="text-green-500">{t("uptimekumamonitor.up")}</span>} else if (isUp.data.includes("Maintenance")) upIndicator = <span style={{color: '#1747f5'}}>{t("uptimekumamonitor.maintenance")}</span>
else if (isUp.data.includes("Maintenance")) {upIndicator = <span style={{color: '#1747f5'}}>{t("uptimekumamonitor.maintenance")}</span>} else if (isUp.data.includes("N/A")) upIndicator = <span>N/A</span>
else if (isUp.data.includes("N/A")) {upIndicator = <span>{"N/A"}</span>} else upIndicator = <span className="text-red-500">{t("uptimekumamonitor.down")}</span>
else {upIndicator = <span className="text-red-500">{t("uptimekumamonitor.down")}</span>}
return ( return (
<Container service={service}> <Container service={service}>

View File

@ -24,5 +24,5 @@ export default async function uptimekumamonitorProxyHandler(req, res) {
}; };
const [status, contentType, data] = await httpProxy(url, params); const [status, contentType, data] = await httpProxy(url, params);
if (contentType) res.setHeader("Content-Type", contentType); if (contentType) res.setHeader("Content-Type", contentType);
return res.status(200).json({data: data.toString()}); return res.status(status).json({data: data.toString()});
} }