Syntax changes to piAlert widget
This commit is contained in:
parent
3e093d2989
commit
52a04209d0
@ -9,27 +9,29 @@ export default function Component({ service }) {
|
||||
|
||||
const { widget } = service;
|
||||
|
||||
const { data: piholeData, error: piholeError } = useWidgetAPI(widget, "data");
|
||||
const { data: pialertData, error: pialertError } = useWidgetAPI(widget, "data");
|
||||
|
||||
if (piholeError) {
|
||||
return <Container service={service} error={piholeError} />;
|
||||
if (pialertError) {
|
||||
return <Container service={service} error={pialertError} />;
|
||||
}
|
||||
|
||||
if (!piholeData) {
|
||||
if (!pialertData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="pialert.total" />
|
||||
<Block label="pialert.connected" />
|
||||
<Block label="pialert.new_devices" />
|
||||
<Block label="pialert.down_alerts" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="pialert.total" value={t("common.number", { value: parseInt(piholeData[0], 10) })} />
|
||||
<Block label="pialert.connected" value={t("common.number", { value: parseInt(piholeData[1], 10) })} />
|
||||
<Block label="pialert.new_devices" value={t("common.number", { value: parseInt(piholeData[3], 10) })} />
|
||||
<Block label="pialert.down_alerts" value={t("common.number", { value: parseInt(piholeData[4], 10) })} />
|
||||
<Block label="pialert.total" value={t("common.number", { value: parseInt(pialertData[0], 10) })} />
|
||||
<Block label="pialert.connected" value={t("common.number", { value: parseInt(pialertData[1], 10) })} />
|
||||
<Block label="pialert.new_devices" value={t("common.number", { value: parseInt(pialertData[3], 10) })} />
|
||||
<Block label="pialert.down_alerts" value={t("common.number", { value: parseInt(pialertData[4], 10) })} />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user