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 { Injectable, inject } from '@angular/core'; |
|||
import { OAuthService } from 'angular-oauth2-oidc'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root', |
|||
}) |
|||
export class LocalStorageListenerService { |
|||
protected readonly window = inject(DOCUMENT).defaultView; |
|||
protected readonly authService = inject(OAuthService); |
|||
|
|||
constructor() { |
|||
this.window.addEventListener('storage', event => { |
|||
if (event.key === 'access_token' && event.newValue === null) { |
|||
this.authService.logOut(); |
|||
this.window.location.reload(); |
|||
} |
|||
}); |
|||
} |
|||
Loading…
Reference in new issue