summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/main.js12
-rw-r--r--frontend/start.js12
-rw-r--r--frontend/start/index.html9
3 files changed, 15 insertions, 18 deletions
diff --git a/frontend/main.js b/frontend/main.js
index 6f953ce..40a965b 100644
--- a/frontend/main.js
+++ b/frontend/main.js
@@ -7,16 +7,6 @@ const data = {
const API_URL = "https://backend.laundryweb.altafcreator.com"
-// --- permission request
-const btn = document.getElementById("notbtn")
-if (btn) {
- btn.addEventListener("click", () => requestPermission())
- function requestPermission() {
- console.log("Requesting permission...");
- OneSignal.Notifications.requestPermission();
- }
-}
-
// --- check user status
// returns true if there exists a timer, and returns false otherwise.
// cookie need to be included.
@@ -216,7 +206,7 @@ async function fetchTimers() {
method: "POST",
credentials: "include",
});
- return await response.json();
+ return [response.status, response.json()];
}
const delay = (durationMs) => {
diff --git a/frontend/start.js b/frontend/start.js
new file mode 100644
index 0000000..f760f11
--- /dev/null
+++ b/frontend/start.js
@@ -0,0 +1,12 @@
+document.getElementById("startbtn").addEventListener("click", () => {
+ start();
+});
+startUpdateMachines();
+
+const notbtn = document.getElementById("notbtn")
+notbtn.addEventListener("click", () => requestPermission())
+function requestPermission() {
+ console.log("Requesting permission...");
+ OneSignal.Notifications.requestPermission();
+}
+const notif = document.getElementById("notif-panel");
diff --git a/frontend/start/index.html b/frontend/start/index.html
index 7567ad5..bd7e407 100644
--- a/frontend/start/index.html
+++ b/frontend/start/index.html
@@ -62,7 +62,7 @@
</div>
<div class="section-container no-pad">
<h1>Start</h1>
- <div class="section-container row bg-red">
+ <div class="section-container row bg-red" id="notif-panel">
<div class="flex-center-container">
<span class="icon">🔔</span>
</div>
@@ -74,11 +74,6 @@
<button class="button bg-1" id="startbtn">Start</button>
</div>
<script src="/main.js"></script>
- <script>
- document.getElementById("startbtn").addEventListener("click", () => {
- start();
- });
- startUpdateMachines();
- </script>
+ <script src="/start.js"></script>
</body>
</html>