v1.5.2 - Notification fixes

This commit is contained in:
Frederik Milling Pytlick 2020-12-01 08:35:53 +01:00 committed by GitHub
parent adfedee25f
commit 2a5a194604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -25,7 +25,6 @@ const assets = [
'/images/logos/Logo-hvid.svg',
'/images/logos/Logo-normal.svg',
'/images/icons/Logout.svg'
];
// install event
@ -88,7 +87,18 @@ self.addEventListener('push', function(event) {
event.waitUntil(self.registration.showNotification(msg.title, {
body: msg.body,
icon: msg.icon,
badge: msg.badge,
actions: msg.actions
}));
}
});
self.addEventListener('notificationclick', (event) => {
event.notification.close();
if (event.action === 'some_action') {
self.clients.openWindow('/home');
} else {
self.clients.openWindow('/')
}
});