summaryrefslogtreecommitdiff
path: root/frontend/main.js
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2026-01-11 22:08:11 +0800
committeraltaf-creator <dev@altafcreator.com>2026-01-11 22:08:11 +0800
commit5918e8e99b33e7853c83155551f7eb46b706e997 (patch)
tree8421a9fa178e9f767aac2d3776f08e3b26220201 /frontend/main.js
parent43ec4deea81d4ef84623c31df33b1c3cb037b0c2 (diff)
stupid
Diffstat (limited to 'frontend/main.js')
-rw-r--r--frontend/main.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/frontend/main.js b/frontend/main.js
index 3f5c4c4..3ce5fb1 100644
--- a/frontend/main.js
+++ b/frontend/main.js
@@ -31,24 +31,26 @@ async function subscribe() {
userVisibleOnly: true,
applicationServerKey: urlBase64ToUint8Array(PUBLIC_VAPID_KEY),
});
+
console.log(subscription);
+
+ console.log("sw regis pass, write to db");
+
+ const db_reply = await fetch(`${API_URL}/notifsubscribe`, {
+ method: 'POST',
+ credentials: "include",
+ body: JSON.stringify(subscription),
+ headers: {
+ "Content-Type": "application/json",
+ },
+ });
+
+ return db_reply.status == 2000;
} catch (e) {
console.log("ERR in regis, ", e);
return false;
}
- console.log("sw regis pass, write to db");
-
- const db_reply = await fetch(`${API_URL}/notifsubscribe`, {
- method: 'POST',
- credentials: "include",
- body: JSON.stringify(subscription),
- headers: {
- "Content-Type": "application/json",
- },
- });
-
- return db_reply.status == 2000;
}
/// copied from somewhere