Skip to content

Commit

Permalink
✨ Averaged data working
Browse files Browse the repository at this point in the history
  • Loading branch information
mawoka-myblock committed Feb 23, 2025
1 parent 674ca47 commit 3bf3f09
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
border-radius: 5px;
cursor: pointer;
}

.action-btn:disabled {
pointer-events: none;
opacity: 0.3;
Expand Down Expand Up @@ -176,8 +177,6 @@ <h1>Td-Free</h1>
stopConnections();
setTimeout(() => {
fetchAveragedData();
averagedBtn.textContent = "Go back to live mode";
averagedBtn.disabled = false
}, 850)
}
}
Expand All @@ -191,8 +190,11 @@ <h1>Td-Free</h1>
function fetchAveragedData() {
fetch("/averaged")
.then(response => response.text())
.then(data => { updateContent(data); document.getElementById("status").textContent = "Showing averaged data" })
.catch(() => document.getElementById("status").textContent = "Error fetching averaged data");
.then(data => {
updateContent(data); document.getElementById("status").textContent = "Showing averaged data"; document.getElementById("averaged-btn").textContent = "Go back to live mode";
document.getElementById("averaged-btn").disabled = false
})
.catch((e) => { document.getElementById("status").textContent = `Error: ${e}` });
}

function updateContent(data) {
Expand Down

0 comments on commit 3bf3f09

Please sign in to comment.