prettier
This commit is contained in:
parent
27896861c8
commit
79d96af924
@ -13,12 +13,9 @@ export default function Widget({ options }) {
|
|||||||
let { refresh } = options;
|
let { refresh } = options;
|
||||||
if (!refresh) refresh = 1500;
|
if (!refresh) refresh = 1500;
|
||||||
|
|
||||||
const { data, error } = useSWR(
|
const { data, error } = useSWR(`/api/widgets/peanut?${new URLSearchParams({ ...options }).toString()}`, {
|
||||||
`/api/widgets/peanut?${new URLSearchParams({ ...options }).toString()}`,
|
refreshInterval: refresh,
|
||||||
{
|
});
|
||||||
refreshInterval: refresh,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (error || data?.error) {
|
if (error || data?.error) {
|
||||||
return <Error options={options} />;
|
return <Error options={options} />;
|
||||||
@ -51,20 +48,20 @@ export default function Widget({ options }) {
|
|||||||
<Resource
|
<Resource
|
||||||
icon={FaCarBattery}
|
icon={FaCarBattery}
|
||||||
value={t("common.number", {
|
value={t("common.number", {
|
||||||
value: data['ups.load'],
|
value: data["ups.load"],
|
||||||
style: "unit",
|
style: "unit",
|
||||||
unit: "percent",
|
unit: "percent",
|
||||||
maximumFractionDigits: 0,
|
maximumFractionDigits: 0,
|
||||||
})}
|
})}
|
||||||
label={t("peanut.load")}
|
label={t("peanut.load")}
|
||||||
expandedValue={t("common.number", {
|
expandedValue={t("common.number", {
|
||||||
value: data['battery.charge'],
|
value: data["battery.charge"],
|
||||||
style: "unit",
|
style: "unit",
|
||||||
unit: "percent",
|
unit: "percent",
|
||||||
maximumFractionDigits: 0,
|
maximumFractionDigits: 0,
|
||||||
})}
|
})}
|
||||||
expandedLabel={t("peanut.battery")}
|
expandedLabel={t("peanut.battery")}
|
||||||
percentage={data['ups.load']}
|
percentage={data["ups.load"]}
|
||||||
expanded={expanded}
|
expanded={expanded}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -45,7 +45,7 @@ export default async function handler(req, res) {
|
|||||||
try {
|
try {
|
||||||
const upsData = await retrieveFromPeanutAPI(privateWidgetOptions, key);
|
const upsData = await retrieveFromPeanutAPI(privateWidgetOptions, key);
|
||||||
const data = {
|
const data = {
|
||||||
...upsData
|
...upsData,
|
||||||
};
|
};
|
||||||
|
|
||||||
return res.status(200).send(data);
|
return res.status(200).send(data);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user