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,15 +206,17 @@ function Notifications({ columnMode }) {
useEffect(() => {
if (uiState === 'default') {
(async () => {
const registration = await getRegistration();
if (registration) {
const notifications = await registration.getNotifications();
console.log('🔔 Push notifications', notifications);
// Close all notifications?
// notifications.forEach((notification) => {
// notification.close();
// });
}
try {
const registration = await getRegistration();
if (registration?.getNotifications) {
const notifications = await registration.getNotifications();
console.log('🔔 Push notifications', notifications);
// Close all notifications?
// notifications.forEach((notification) => {
// notification.close();
// });
}
} catch (e) {}
})();
}
}, [uiState]);