chore: add debug logging for push notifications
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
self.addEventListener('push', function (event) {
|
||||
if (!event.data) return;
|
||||
console.log('[SW] Push Received', event);
|
||||
if (!event.data) {
|
||||
console.log('[SW] No data provided in push event');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const data = event.data.json();
|
||||
console.log('[SW] Push Data:', data);
|
||||
const title = data.title || 'Cat Sitting Planner';
|
||||
const options = {
|
||||
body: data.body || '',
|
||||
@@ -15,6 +20,8 @@ self.addEventListener('push', function (event) {
|
||||
|
||||
event.waitUntil(
|
||||
self.registration.showNotification(title, options)
|
||||
.then(() => console.log('[SW] Notification shown'))
|
||||
.catch(e => console.error('[SW] Error showing notification:', e))
|
||||
);
|
||||
} catch (err) {
|
||||
console.error('Error processing push event:', err);
|
||||
|
||||
Reference in New Issue
Block a user