diff options
Diffstat (limited to 'frontend/start.js')
| -rw-r--r-- | frontend/start.js | 13 |
1 files changed, 9 insertions, 4 deletions
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; } |
