diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-11-29 23:56:41 +0700 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-11-29 23:56:41 +0700 |
| commit | ec0e79e779e012ed66b5690cd5629745bcf8f3cc (patch) | |
| tree | 75c4589ea2d199f56a8fdacf507579705ae4869c | |
| parent | 1da6db6bfeb14e0bf283eff354eca62691417308 (diff) | |
notifiaction panel, implemented some status codes
| -rw-r--r-- | frontend/main.js | 9 | ||||
| -rw-r--r-- | 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(); +} |
