Fix error not showing up in failed push subscription

This commit is contained in:
Pavel Djundik 2017-12-24 22:04:27 +02:00
parent ff6d6e3e82
commit 80c11f2bde
1 changed files with 6 additions and 4 deletions

View File

@ -68,7 +68,7 @@ module.exports.initialize = () => {
function onPushButton() { function onPushButton() {
pushNotificationsButton.attr("disabled", true); pushNotificationsButton.attr("disabled", true);
navigator.serviceWorker.ready.then((registration) => { navigator.serviceWorker.ready.then((registration) =>
registration.pushManager.getSubscription().then((existingSubscription) => { registration.pushManager.getSubscription().then((existingSubscription) => {
if (existingSubscription) { if (existingSubscription) {
socket.emit("push:unregister"); socket.emit("push:unregister");
@ -100,9 +100,11 @@ function onPushButton() {
if (successful) { if (successful) {
alternatePushButton().removeAttr("disabled"); alternatePushButton().removeAttr("disabled");
} }
}); })
}).catch((err) => { ).catch((err) => {
$("#pushNotificationsUnsupported span").text(err).show(); $("#pushNotificationsUnsupported")
.find("span").text(`An error has occured: ${err}`).end()
.show();
}); });
return false; return false;