diff options
| author | Adam Soltys <[email protected]> | 2022-09-06 09:20:25 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-06 09:20:25 -0700 |
| commit | c2464b2407ee23134732fd67586758dbfe18f9b5 (patch) | |
| tree | 3e2d9f009bb325a9a7c4304ea02f6e64dda85bd1 /lib/notifications.js | |
| parent | 8a080ef9a198799e7ee31cf81f92afd5495e4074 (diff) | |
| download | coinos-server-c2464b2407ee23134732fd67586758dbfe18f9b5.tar.gz coinos-server-c2464b2407ee23134732fd67586758dbfe18f9b5.zip | |
prettier
Diffstat (limited to 'lib/notifications.js')
| -rw-r--r-- | lib/notifications.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/notifications.js b/lib/notifications.js index 49ac32f7..9c9c95dc 100644 --- a/lib/notifications.js +++ b/lib/notifications.js @@ -1,5 +1,5 @@ import config from "$config"; -import webpush from 'web-push'; +import webpush from "web-push"; if (config.vapid) { webpush.setVapidDetails( @@ -17,9 +17,12 @@ export const notify = (user, payload) => { try { await webpush.sendNotification(subscription, payload); } catch (e) { - if (e.body && (e.body.includes('expired') || e.body.includes('No such'))) { + if ( + e.body && + (e.body.includes("expired") || e.body.includes("No such")) + ) { user.subscriptions.splice(i, 1); - await user.save(); + await user.save(); } else { err("problem sending notification", e); } |
