Output error if vapid key can't be reached

This commit is contained in:
Alex Gleason 2020-04-27 13:39:59 -05:00
parent e3a750df28
commit 099ff10987
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -13,7 +13,11 @@ const urlBase64ToUint8Array = (base64String) => {
return decodeBase64(base64);
};
const getApplicationServerKey = getState => getState().getIn(['auth', 'app', 'vapid_key']);
const getApplicationServerKey = getState => {
const key = getState().getIn(['auth', 'app', 'vapid_key']);
if (!key) console.error('Could not get vapid key. Push notifications will not work.');
return key;
};
const getRegistration = () => navigator.serviceWorker.ready;