Minor fixes & improvements

- Move push subscription handling to Notifier class
- Allow duplicate options in config
- Only save subscription in frontend if sub call was successful
This commit is contained in:
2021-06-11 01:04:44 +02:00
parent 618f00a09a
commit 4ee4869f82
4 changed files with 17 additions and 9 deletions

View File

@ -250,7 +250,6 @@ function initPush(name) {
applicationServerKey: pushServerPublicKey
}).then(function(subscription) {
console.log("User is subscribed:", subscription);
localStorage.setItem('pushsub', subscription);
fetch('/pushsubscribe', {
method: "POST",
@ -259,6 +258,9 @@ function initPush(name) {
name: name,
sub: subscription
})
}).then(function(res) {
if (res.ok)
localStorage.setItem('pushsub', subscription);
});
});
});