chore: fix a sync issue
This commit is contained in:
parent
67407a1426
commit
2e12b2cec7
1 changed files with 8 additions and 1 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue