Fix getNotifications is not a function

This commit is contained in:
Lim Chee Aun 2023-09-07 12:17:31 +08:00
parent 1c295c585b
commit 61f2132abd

View file

@ -206,8 +206,9 @@ function Notifications({ columnMode }) {
useEffect(() => {
if (uiState === 'default') {
(async () => {
try {
const registration = await getRegistration();
if (registration) {
if (registration?.getNotifications) {
const notifications = await registration.getNotifications();
console.log('🔔 Push notifications', notifications);
// Close all notifications?
@ -215,6 +216,7 @@ function Notifications({ columnMode }) {
// notification.close();
// });
}
} catch (e) {}
})();
}
}, [uiState]);