fix logout behavior when there is no push subscription
This commit is contained in:
parent
2f3a942583
commit
f6d8867df2
|
@ -35,7 +35,7 @@ export async function signout() {
|
|||
try {
|
||||
const registration = await navigator.serviceWorker.ready;
|
||||
const push = await registration.pushManager.getSubscription();
|
||||
if (!push) return;
|
||||
if (push) {
|
||||
await fetch(`${apiUrl}/sw/unregister`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
|
@ -43,6 +43,7 @@ export async function signout() {
|
|||
endpoint: push.endpoint,
|
||||
}),
|
||||
});
|
||||
}
|
||||
} catch (e) {}
|
||||
//#endregion
|
||||
|
||||
|
|
Loading…
Reference in New Issue