diff --git a/app/components/settings/notifications.tsx b/app/components/settings/notifications.tsx index 5495e58..ff151ca 100644 --- a/app/components/settings/notifications.tsx +++ b/app/components/settings/notifications.tsx @@ -98,7 +98,10 @@ export default function NotificationSettings() { try { const result = await registerNotification(); if ("error" in result && result.error) { - console.error("Failed to unregister previous notifications:", result.error); + console.error( + "Failed to unregister previous notifications:", + result.error + ); } else { setPushEnabled(true); } @@ -133,6 +136,10 @@ export default function NotificationSettings() { ); useEffect(() => { setEvents(currentSubscription?.events || []); + if (pushEnabled && !currentSubscription) { + setPushEnabled(false); + localStorage.removeItem(STORAGE_KEY); + } }, [currentSubscription]); async function handleDelete(subscriptionId: string) {