From 099ff109879cfeef99b1c74b44889f838665e9cf Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 27 Apr 2020 13:39:59 -0500 Subject: [PATCH] Output error if vapid key can't be reached --- app/gabsocial/actions/push_notifications/registerer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/gabsocial/actions/push_notifications/registerer.js b/app/gabsocial/actions/push_notifications/registerer.js index e51d8a0ca..91b6cd6a3 100644 --- a/app/gabsocial/actions/push_notifications/registerer.js +++ b/app/gabsocial/actions/push_notifications/registerer.js @@ -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;