Skip to content

Commit 10f5232

Browse files
committed
Clean
1 parent 78d7074 commit 10f5232

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

web/lib/service/notifications.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,38 @@ export default function PushSubscriber() {
1717
navigator.serviceWorker
1818
.register('/service-worker.js')
1919
.then(async (registration) => {
20-
console.log('Service worker registered:', registration);
20+
console.log('Service worker registered:', registration)
2121

2222
const permission = await Notification.requestPermission();
2323
if (permission !== 'granted') {
24-
console.log('Notification permission denied');
24+
console.log('Notification permission denied')
2525
return
26-
};
26+
}
2727

2828
// Check if already subscribed
2929
const existing = await registration.pushManager.getSubscription();
3030
if (existing) {
31-
console.log('Already subscribed:', existing);
31+
console.log('Already subscribed:', existing)
3232
return
3333
} // already subscribed
3434

3535
const subscription = await registration.pushManager.subscribe({
3636
userVisibleOnly: true,
3737
applicationServerKey: urlBase64ToUint8Array(vapidPublicKey),
38-
});
38+
})
3939

4040
// Send subscription to server
41-
const {data} = await api('save-subscription', {subscription});
42-
console.log('Subscription saved:', data);
41+
const {data} = await api('save-subscription', {subscription})
42+
console.log('Subscription saved:', data)
4343
})
4444
.catch((err) => {
4545
console.error('SW registration failed:', err)
4646
return
47-
});
47+
})
4848
};
4949

50-
registerPush();
51-
}, [user?.id]);
50+
registerPush()
51+
}, [user?.id])
5252

5353
return null; // component doesn't render anything
5454
}

0 commit comments

Comments
 (0)