diff --git a/frontend/scripts/home.js b/frontend/scripts/home.js index 592470d..3ee54b6 100644 --- a/frontend/scripts/home.js +++ b/frontend/scripts/home.js @@ -81,9 +81,6 @@ async function fetchData() { const startDate = document.getElementById("period-start").valueAsDate?.toISOString(); const endDate = document.getElementById("period-end").valueAsDate?.toISOString(); - const devices = await getDevices() - .catch(handleError); - const deviceData = []; for (const device of devices) { @@ -99,6 +96,7 @@ async function fetchData() { return; } + document.getElementById("table-body").innerHTML = ""; buildTable(deviceData[0]); if (!chart) { @@ -181,6 +179,8 @@ document.getElementById("all-time").onclick = () => setPeriod(null, null); document.querySelector(".logout-container").addEventListener("click", logout); +const devices = await getDevices().catch(handleError); + setPeriodLastDays(3); fetchData();