summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--frontend/main.js9
-rw-r--r--frontend/start.js3
2 files changed, 10 insertions, 2 deletions
diff --git a/frontend/main.js b/frontend/main.js
index 40a965b..e20a467 100644
--- a/frontend/main.js
+++ b/frontend/main.js
@@ -134,7 +134,12 @@ async function updateMachines() {
// --- current timers
async function startLoadTimers() {
- const timers = await fetchTimers();
+ const timersData = await fetchTimers();
+
+ if (timersData[0] != 200) {
+ console.error(timersData[0].toString() + " from backend: " + timersData[1]);
+ return;
+ }
const container = document.getElementById("timer-container")
@@ -206,7 +211,7 @@ async function fetchTimers() {
method: "POST",
credentials: "include",
});
- return [response.status, response.json()];
+ return [response.status, await response.json()];
}
const delay = (durationMs) => {
diff --git a/frontend/start.js b/frontend/start.js
index f760f11..4c860e5 100644
--- a/frontend/start.js
+++ b/frontend/start.js
@@ -10,3 +10,6 @@ function requestPermission() {
OneSignal.Notifications.requestPermission();
}
const notif = document.getElementById("notif-panel");
+if (Notification.permission == 'granted') {
+ notif.remove();
+}