File tree Expand file tree Collapse file tree
packages/client/components/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,9 +121,7 @@ class Lifecycle {
121121
122122 private dispose ( ) {
123123 if ( this . client ) {
124- this . client . events . removeAllListeners ( ) ;
125- this . client . removeAllListeners ( ) ;
126- this . client . events . disconnect ( ) ;
124+ this . client . logout ( ) ;
127125 }
128126
129127 this . client = new Client ( {
@@ -599,7 +597,7 @@ export default class ClientController {
599597
600598 logout ( ) {
601599 this . state . settings . resetNotificationsState ( ) ;
602- killServiceWorkerSubscription ( this . getCurrentClient ( ) ) ;
600+ killServiceWorkerSubscription ( this . getCurrentClient ( ) , true ) ;
603601 this . state . auth . removeSession ( ) ;
604602 this . lifecycle . transition ( {
605603 type : TransitionType . Logout ,
Original file line number Diff line number Diff line change @@ -173,7 +173,10 @@ function arrayBufferToBase64URL(buffer: ArrayBuffer): string {
173173}
174174
175175/** Exported for the client controller. Don't use this unless you have to. */
176- export async function killServiceWorkerSubscription ( client : Client ) {
176+ export async function killServiceWorkerSubscription (
177+ client : Client ,
178+ loggingOut ?: boolean ,
179+ ) {
177180 if ( IS_DEV ) {
178181 console . log ( "Skipping killing push worker in dev." ) ;
179182 return ;
@@ -183,6 +186,6 @@ export async function killServiceWorkerSubscription(client: Client) {
183186 if ( ! registration ) return ;
184187 const subscription = await registration . pushManager . getSubscription ( ) ;
185188 if ( await subscription ?. unsubscribe ( ) ) {
186- await client . api . post ( "/push/unsubscribe" ) ;
189+ if ( ! loggingOut ) await client . api . post ( "/push/unsubscribe" ) ;
187190 }
188191}
You can’t perform that action at this time.
0 commit comments