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 {
|
try {
|
||||||
const result = await registerNotification();
|
const result = await registerNotification();
|
||||||
if ("error" in result && result.error) {
|
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 {
|
} else {
|
||||||
setPushEnabled(true);
|
setPushEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
@ -133,6 +136,10 @@ export default function NotificationSettings() {
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setEvents(currentSubscription?.events || []);
|
setEvents(currentSubscription?.events || []);
|
||||||
|
if (pushEnabled && !currentSubscription) {
|
||||||
|
setPushEnabled(false);
|
||||||
|
localStorage.removeItem(STORAGE_KEY);
|
||||||
|
}
|
||||||
}, [currentSubscription]);
|
}, [currentSubscription]);
|
||||||
|
|
||||||
async function handleDelete(subscriptionId: string) {
|
async function handleDelete(subscriptionId: string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue