Add logout event handler
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
b3d0a6f0c7
commit
f89209c555
@ -14,10 +14,10 @@ export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthS
|
|||||||
appConfig.load().then(() => {
|
appConfig.load().then(() => {
|
||||||
oauthService.events.subscribe((event) => {
|
oauthService.events.subscribe((event) => {
|
||||||
console.debug(event.type);
|
console.debug(event.type);
|
||||||
if (event.type == 'token_error' || event.type == 'silent_refresh_timeout') {
|
if (event.type == 'token_error' || event.type == 'silent_refresh_timeout' || event.type == 'logout') {
|
||||||
let e = event as OAuthErrorEvent;
|
let e = event as OAuthErrorEvent;
|
||||||
let p = e.params as any;
|
let p = e.params as any;
|
||||||
if (event.type == 'silent_refresh_timeout' || (p.error && p.error == 'login_required')) {
|
if (event.type == 'silent_refresh_timeout' || event.type == 'logout' || (p.error && p.error == 'login_required')) {
|
||||||
let router = injector.get(Router);
|
let router = injector.get(Router);
|
||||||
console.debug("Session expired");
|
console.debug("Session expired");
|
||||||
router.navigate(['loggedout'], { queryParams: { redirectTo: router.url } });
|
router.navigate(['loggedout'], { queryParams: { redirectTo: router.url } });
|
||||||
|
Loading…
Reference in New Issue
Block a user