diff options
| author | altaf-creator <dev@altafcreator.com> | 2026-01-11 22:08:11 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2026-01-11 22:08:11 +0800 |
| commit | 5918e8e99b33e7853c83155551f7eb46b706e997 (patch) | |
| tree | 8421a9fa178e9f767aac2d3776f08e3b26220201 /frontend/main.js | |
| parent | 43ec4deea81d4ef84623c31df33b1c3cb037b0c2 (diff) | |
stupid
Diffstat (limited to 'frontend/main.js')
| -rw-r--r-- | frontend/main.js | 26 |
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 |
