From 076791c52fc87b430e2bd0d36e5ef6fa11d6a782 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Mon, 1 Dec 2025 18:06:09 +0700 Subject: yay it works. changes to notification permission request --- frontend/index.html | 2 +- frontend/start.js | 13 +++++++++---- frontend/start/index.html | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 0eeb0b0..c67b294 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -35,7 +35,7 @@ (async () => { const result = await checkUserStatus(); if (result != "you got laundry") { - window.location.href = './start/'; + window.location.href = './status/'; } else { window.location.href = './timer/'; } diff --git a/frontend/start.js b/frontend/start.js index 21c5a6d..5c9fc5d 100644 --- a/frontend/start.js +++ b/frontend/start.js @@ -8,14 +8,19 @@ console.log(urlParams); startUpdateMachines(); -const notbtn = document.getElementById("notbtn") +const notbtn = document.getElementById("notbtn"); +const startbtn = document.getElementById("startbtn"); notbtn.addEventListener("click", () => requestPermission()) async function requestPermission() { console.log("Requesting permission..."); - const onesig_res = await OneSignal.Notifications.requestPermission(); - alert(onesig_res); + const onesignal_result = await OneSignal.Notifications.requestPermission(); + if (onesignal_result) { + notif.remove(); + startbtn.disabled = false; + } } const notif = document.getElementById("notif-panel"); -if (Notification.permission == 'granted') { +if (OneSignal.Notifications.permission) { notif.remove(); + startbtn.disabled = false; } diff --git a/frontend/start/index.html b/frontend/start/index.html index bd7e407..0f8a0cf 100644 --- a/frontend/start/index.html +++ b/frontend/start/index.html @@ -71,7 +71,7 @@ - + -- cgit v1.2.3