fix refresh sensorData

This commit is contained in:
MichaelDvP
2022-01-24 12:49:57 +01:00
parent b0111d6653
commit e02f20d74e

View File

@@ -103,7 +103,7 @@ const DashboardData: FC = () => {
} }
loadData(); loadData();
if (selectedDevice === 0) { if (sensorData) {
fetchSensorData(); fetchSensorData();
} else if (selectedDevice) { } else if (selectedDevice) {
fetchDeviceData(selectedDevice); fetchDeviceData(selectedDevice);
@@ -116,7 +116,7 @@ const DashboardData: FC = () => {
clearInterval(timer); clearInterval(timer);
}; };
// eslint-disable-next-line // eslint-disable-next-line
}, [analog, sensor, deviceValue, selectedDevice]); }, [analog, sensor, deviceValue, sensorData, selectedDevice]);
const fetchDeviceData = async (unique_id: number) => { const fetchDeviceData = async (unique_id: number) => {
try { try {