speedtest widget, catch api errors

pull/326/head
Ben Phelps 2 years ago
parent a63f71d3ee
commit 07e99768e6

@ -11,7 +11,7 @@ export default function Component({ service }) {
const { data: speedtestData, error: speedtestError } = useWidgetAPI(widget, "speedtest/latest"); const { data: speedtestData, error: speedtestError } = useWidgetAPI(widget, "speedtest/latest");
if (speedtestError) { if (speedtestError || (speedtestData && !speedtestData.data)) {
return <Container error={t("widget.api_error")} />; return <Container error={t("widget.api_error")} />;
} }
@ -31,10 +31,7 @@ export default function Component({ service }) {
label="speedtest.download" label="speedtest.download"
value={t("common.bitrate", { value: speedtestData.data.download * 1024 * 1024 })} value={t("common.bitrate", { value: speedtestData.data.download * 1024 * 1024 })}
/> />
<Block <Block label="speedtest.upload" value={t("common.bitrate", { value: speedtestData.data.upload * 1024 * 1024 })} />
label="speedtest.upload"
value={t("common.bitrate", { value: speedtestData.data.upload * 1024 * 1024 })}
/>
<Block <Block
label="speedtest.ping" label="speedtest.ping"
value={t("common.ms", { value={t("common.ms", {

Loading…
Cancel
Save