Remove notification after click

This commit is contained in:
Karina Kwiatek 2022-12-26 11:09:25 +00:00
parent 67423699b6
commit ba3c406bc7
1 changed files with 4 additions and 1 deletions

View File

@ -16,7 +16,10 @@ self.addEventListener('push', function (event) {
self.addEventListener('notificationclick', async event => { self.addEventListener('notificationclick', async event => {
if (event.notification.tag === 'inbox') { if (event.notification.tag === 'inbox') {
event.preventDefault(); event.preventDefault();
return clients.openWindow("/inbox", "_blank"); return clients.openWindow("/inbox", "_blank").then(result => {
event.notification.close();
return result;
});
} else { } else {
console.warn(`Unhandled notification tag: ${event.notification.tag}`); console.warn(`Unhandled notification tag: ${event.notification.tag}`);
} }