summaryrefslogtreecommitdiff
path: root/frontend/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/main.js')
-rw-r--r--frontend/main.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/frontend/main.js b/frontend/main.js
index 90c3e5c..06938ed 100644
--- a/frontend/main.js
+++ b/frontend/main.js
@@ -183,10 +183,13 @@ async function startLoadTimers() {
textList.push(`timer-txt-${i}`);
progList.push(`timer-prog-${i}`);
endTimestamps.push(Date.parse(timers[i]["start_time"]) + timers[i]["duration"] * 60000);
+ }
+ for (let i = 0; i < timers.length; i++) { // html rebuilds everytime innerHTML is modified
document.getElementById(`timer-btn-${i}`).addEventListener("click", function () {
finishLaundryTimer(timers[i]["id"]);
});
+ console.log("added!");
}
console.log(textList);
@@ -235,7 +238,7 @@ async function finishLaundryTimer(timerId) {
body: JSON.stringify({id: timerId}),
});
if (await response.text() == "laundry finished") {
- document.getElementById(`timer-${timerId}`).remove();
+ window.location.reload();
}
}