mirror of https://github.com/abpframework/abp.git
5 changed files with 11 additions and 12 deletions
@ -1,18 +1,16 @@ |
|||||
import { DOCUMENT } from '@angular/common'; |
import { DOCUMENT } from '@angular/common'; |
||||
import { Injectable, inject } from '@angular/core'; |
import { Injectable, inject } from '@angular/core'; |
||||
import { OAuthService } from 'angular-oauth2-oidc'; |
|
||||
|
|
||||
@Injectable({ |
@Injectable({ |
||||
providedIn: 'root', |
providedIn: 'root', |
||||
}) |
}) |
||||
export class LocalStorageListenerService { |
export class LocalStorageListenerService { |
||||
protected readonly window = inject(DOCUMENT).defaultView; |
protected readonly window = inject(DOCUMENT).defaultView; |
||||
protected readonly authService = inject(OAuthService); |
|
||||
|
|
||||
constructor() { |
constructor() { |
||||
this.window.addEventListener('storage', event => { |
this.window.addEventListener('storage', event => { |
||||
if (event.key === 'access_token' && event.newValue === null) { |
if (event.key === 'access_token' && event.newValue === null) { |
||||
this.authService.logOut(); |
this.window.location.reload(); |
||||
} |
} |
||||
}); |
}); |
||||
} |
} |
||||
Loading…
Reference in new issue