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