fix logout behavior when there is no push subscription 2
This commit is contained in:
parent
f6d8867df2
commit
b2e21db0b3
|
@ -33,16 +33,18 @@ export async function signout() {
|
||||||
|
|
||||||
//#region Remove push notification registration
|
//#region Remove push notification registration
|
||||||
try {
|
try {
|
||||||
const registration = await navigator.serviceWorker.ready;
|
if (navigator.serviceWorker.controller) {
|
||||||
const push = await registration.pushManager.getSubscription();
|
const registration = await navigator.serviceWorker.ready;
|
||||||
if (push) {
|
const push = await registration.pushManager.getSubscription();
|
||||||
await fetch(`${apiUrl}/sw/unregister`, {
|
if (push) {
|
||||||
method: 'POST',
|
await fetch(`${apiUrl}/sw/unregister`, {
|
||||||
body: JSON.stringify({
|
method: 'POST',
|
||||||
i: $i.token,
|
body: JSON.stringify({
|
||||||
endpoint: push.endpoint,
|
i: $i.token,
|
||||||
}),
|
endpoint: push.endpoint,
|
||||||
});
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
Loading…
Reference in New Issue