This commit is contained in:
Josh Hawkins 2025-05-16 10:05:50 -05:00
parent 66eef1474a
commit 066fff81f7

View File

@ -165,23 +165,23 @@ export default function NotificationView({
const [registration, setRegistration] =
useState<ServiceWorkerRegistration | null>();
// useEffect(() => {
// if (!("Notification" in window) || !window.isSecureContext) {
// return;
// }
// navigator.serviceWorker
// .getRegistration(NOTIFICATION_SERVICE_WORKER)
// .then((worker) => {
// if (worker) {
// setRegistration(worker);
// } else {
// setRegistration(null);
// }
// })
// .catch(() => {
// setRegistration(null);
// });
// }, []);
useEffect(() => {
if (!("Notification" in window) || !window.isSecureContext) {
return;
}
navigator.serviceWorker
.getRegistration(NOTIFICATION_SERVICE_WORKER)
.then((worker) => {
if (worker) {
setRegistration(worker);
} else {
setRegistration(null);
}
})
.catch(() => {
setRegistration(null);
});
}, []);
// form