mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-13 20:52:45 +08:00
homeassistant widget minor code cleanup / changes
- limit to 4 blocks - allow container to handle field filtering
This commit is contained in:
@@ -5,12 +5,12 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
export default function Component({ service }) {
|
||||
const { widget } = service;
|
||||
|
||||
const { data, error } = useWidgetAPI(widget, "", { refreshInterval: 60000 });
|
||||
const { data, error } = useWidgetAPI(widget, null, { refreshInterval: 60000 });
|
||||
if (error) {
|
||||
return <Container error={error} />;
|
||||
}
|
||||
const panels = [];
|
||||
data?.forEach(d => panels.push(<Block label={d.label} value={d.value} />));
|
||||
|
||||
return <Container service={service}>{panels}</Container>;
|
||||
|
||||
return <Container service={service}>
|
||||
{data?.map(d => <Block label={d.label} value={d.value} key={d.label} />)}
|
||||
</Container>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user