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

View file

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