Merge branch 'hotfix/update_subscription' into develop

This commit is contained in:
ostertun
2020-10-09 12:59:35 +02:00
2 changed files with 14 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
<?php
define('PWA_VERSION', '1.10.3h1');
define('PWA_VERSION', '1.10.3h2');
?>

View File

@@ -311,3 +311,16 @@ self.addEventListener('notificationclick', function(event) {
clients.openWindow(url)
);
});
self.addEventListener('pushsubscriptionchange', function(event) {
var formData = new URLSearchParams();
formData.append('old', JSON.stringify(event.oldSubscription));
formData.append('new', JSON.stringify(event.newSubscription));
event.waitUntil(
fetch('<?php echo QUERY_URL; ?>update_subscription', {
method: 'POST',
cache: 'no-cache',
body: formData
})
);
});