From ec0e79e779e012ed66b5690cd5629745bcf8f3cc Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Sat, 29 Nov 2025 23:56:41 +0700 Subject: notifiaction panel, implemented some status codes --- frontend/main.js | 9 +++++++-- frontend/start.js | 3 +++ 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(); +} -- cgit v1.2.3