mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 01:30:23 +01:00
fix logout behavior when there is no push subscription
This commit is contained in:
parent
2f3a942583
commit
f6d8867df2
1 changed files with 9 additions and 8 deletions
|
@ -35,14 +35,15 @@ export async function signout() {
|
||||||
try {
|
try {
|
||||||
const registration = await navigator.serviceWorker.ready;
|
const registration = await navigator.serviceWorker.ready;
|
||||||
const push = await registration.pushManager.getSubscription();
|
const push = await registration.pushManager.getSubscription();
|
||||||
if (!push) return;
|
if (push) {
|
||||||
await fetch(`${apiUrl}/sw/unregister`, {
|
await fetch(`${apiUrl}/sw/unregister`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
i: $i.token,
|
i: $i.token,
|
||||||
endpoint: push.endpoint,
|
endpoint: push.endpoint,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue