chore: fix a sync issue

This commit is contained in:
Nathan Lamy 2025-08-20 12:41:17 +02:00
parent 67407a1426
commit 2e12b2cec7

View file

@ -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) {