fuck youuuuuuuuuuuuuuuu

This commit is contained in:
Henry Jameson 2023-12-13 22:23:56 +02:00
parent e0eaf961c4
commit a3733eae60

View file

@ -59,21 +59,19 @@ const setSettings = async () => {
}
const showPushNotification = async (event) => {
const activeClients = await getWindowClients()
// const activeClients = await getWindowClients()
await setSettings()
// Only show push notifications if all tabs/windows are closed
if (activeClients.length === 0) {
const data = event.data.json()
const data = event.data.json()
const url = `${self.registration.scope}api/v1/notifications/${data.notification_id}`
const notification = await fetch(url, { headers: { Authorization: 'Bearer ' + data.access_token } })
const notificationJson = await notification.json()
const parsedNotification = parseNotification(notificationJson)
const url = `${self.registration.scope}api/v1/notifications/${data.notification_id}`
const notification = await fetch(url, { headers: { Authorization: 'Bearer ' + data.access_token } })
const notificationJson = await notification.json()
const parsedNotification = parseNotification(notificationJson)
const res = prepareNotificationObject(parsedNotification, i18n)
const res = prepareNotificationObject(parsedNotification, i18n)
return self.registration.showNotification(res.title, res)
}
return self.registration.showNotification(res.title, res)
}
self.addEventListener('push', async (event) => {