ServiceWorker: console.error on empty push event
This commit is contained in:
parent
7a14d56f9f
commit
725be075d9
1 changed files with 4 additions and 2 deletions
|
@ -134,8 +134,10 @@ const htmlToPlainText = (html: string): string =>
|
|||
|
||||
/** ServiceWorker `push` event callback. */
|
||||
const handlePush = (event: PushEvent) => {
|
||||
// If event has no data, stop here.
|
||||
if (!event.data) return;
|
||||
if (!event.data) {
|
||||
console.error('An empty web push event was received.', { event });
|
||||
return;
|
||||
}
|
||||
|
||||
const { access_token, notification_id, preferred_locale, title, body, icon } = event.data.json();
|
||||
|
||||
|
|
Loading…
Reference in a new issue