mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-18 19:36:00 +01:00
Open inbox on notification click
This commit is contained in:
parent
a04b290067
commit
4e65954a7a
1 changed files with 11 additions and 1 deletions
|
@ -4,9 +4,19 @@ self.addEventListener('push', function (event) {
|
|||
console.log(event.data);
|
||||
|
||||
event.waitUntil(self.registration.showNotification(notification.title, {
|
||||
body: notification.body
|
||||
body: notification.body,
|
||||
tag: notification.type
|
||||
}));
|
||||
} else {
|
||||
console.error("Push event received, but it didn't contain any data.", event);
|
||||
}
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclick', async event => {
|
||||
if (event.notification.tag === 'inbox') {
|
||||
event.preventDefault();
|
||||
return clients.openWindow("/inbox", "_blank");
|
||||
} else {
|
||||
console.warn(`Unhandled notification tag: ${event.notification.tag}`);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue