chore: add debug logging for push notifications

This commit is contained in:
2026-01-13 11:09:54 +01:00
parent 8e87c5741e
commit 0ebe2172f4
4 changed files with 90 additions and 37 deletions

View File

@@ -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);