[Glitch] Add missing rejection handling for Promises

Port missing parts from 2c51bc0ca5 to glitch-soc
This commit is contained in:
Thibaut Girka
2019-02-10 21:28:29 +01:00
parent 6b2eefc7bf
commit a963ea67dd
8 changed files with 54 additions and 29 deletions

View File

@@ -109,14 +109,11 @@ export function register () {
pushNotificationsSetting.remove(me);
}
try {
getRegistration()
.then(getPushSubscription)
.then(unsubscribe);
} catch (e) {
}
});
return getRegistration()
.then(getPushSubscription)
.then(unsubscribe);
})
.catch(console.warn);
} else {
console.warn('Your browser does not support Web Push Notifications.');
}
@@ -137,6 +134,6 @@ export function saveSettings() {
if (me) {
pushNotificationsSetting.set(me, data);
}
});
}).catch(console.warn);
};
}