const btn = document.getElementById("notbtn") btn.addEventListener("click", () => requestPermission()) function requestPermission() { console.log("Requesting permission..."); Notification.requestPermission().then((permission) => { if (permission === "granted") { console.log("Notification permission granted."); } }); } if ("serviceWorker" in navigator) { navigator.serviceWorker .register("OneSignalSDKWorker.js") .then((reg) => console.log("SW registered:", reg)) .catch((err) => console.error("SW failed:", err)); } document.cookie = "session_key=0" const data = { duration: 2, block: 1, machine: 2, } fetch("http://localhost:8000/start", { credentials: "include", method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data) });