mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 06:35:24 +03:00
Correctly unsubscribe notifications
This commit is contained in:
parent
9824cb86ba
commit
9d8104618e
@ -170,7 +170,8 @@ class WebPushClient(Communicator): # type: ignore[misc]
|
||||
|
||||
if resp.status_code == 201:
|
||||
pass
|
||||
elif resp.status_code == 410:
|
||||
elif resp.status_code == 404 or resp.status_code == 410:
|
||||
# subscription is not found or has been unsubscribed
|
||||
if not self.expired_subs.get(user):
|
||||
self.expired_subs[user] = []
|
||||
|
||||
|
||||
@ -290,9 +290,17 @@ export default function NotificationView({
|
||||
}
|
||||
});
|
||||
} else {
|
||||
registration.unregister();
|
||||
setRegistration(null);
|
||||
removeMessage("notification_settings", "registration");
|
||||
registration.pushManager
|
||||
.getSubscription()
|
||||
.then((pushSubscription) => {
|
||||
pushSubscription?.unsubscribe();
|
||||
registration.unregister();
|
||||
setRegistration(null);
|
||||
removeMessage(
|
||||
"notification_settings",
|
||||
"registration",
|
||||
);
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user