summaryrefslogtreecommitdiff
path: root/ui/lib/session.svelte.js
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-11-10 20:51:11 -0500
committerOwen Jacobson <owen@grimoire.ca>2025-11-10 20:51:11 -0500
commit91c33501a315abe04aeed54aa27388ce0ad241ce (patch)
tree56b7be71cc9811f86f5e59e02358d24bad57c1d2 /ui/lib/session.svelte.js
parent73d79002fe6018ab12457b37bdaeb76ff2800213 (diff)
Push messaging fixes:
* Remove push subscriptions on logout, to trigger a resubscription when logging back in. * Don't try to call `this.push` when there's no `this` to have a `push` on.
Diffstat (limited to 'ui/lib/session.svelte.js')
-rw-r--r--ui/lib/session.svelte.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/lib/session.svelte.js b/ui/lib/session.svelte.js
index cd41aa4..74508ea 100644
--- a/ui/lib/session.svelte.js
+++ b/ui/lib/session.svelte.js
@@ -145,7 +145,12 @@ async function bootOrNavigate(navigateTo) {
} catch (err) {
switch (true) {
case err instanceof api.LoggedOut:
- await this.push.unsubscribe();
+ // Can't use `Push` state manager here as it requires boot, which we just failed to do.
+ const sw = await navigator.serviceWorker.ready;
+ const subscription = await sw.pushManager.getSubscription();
+ if (subscription !== null) {
+ await subscription.unsubscribe();
+ }
await navigateTo('/login');
break;
case err instanceof api.SetupRequired: