mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
redirect to login when reloading page with expired ticket (#446)
This commit is contained in:
@@ -25,7 +25,9 @@
|
|||||||
|
|
||||||
import { Component, OnInit, EventEmitter } from '@angular/core';
|
import { Component, OnInit, EventEmitter } from '@angular/core';
|
||||||
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
|
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
|
||||||
import { PageTitleService, AppConfigService, FileModel, UploadService } from '@alfresco/adf-core';
|
import {
|
||||||
|
PageTitleService, AppConfigService, FileModel, UploadService,
|
||||||
|
AuthenticationService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||||
import { ElectronService } from '@ngstack/electron';
|
import { ElectronService } from '@ngstack/electron';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppStore } from './store/states/app.state';
|
import { AppStore } from './store/states/app.state';
|
||||||
@@ -43,11 +45,21 @@ export class AppComponent implements OnInit {
|
|||||||
private pageTitle: PageTitleService,
|
private pageTitle: PageTitleService,
|
||||||
private store: Store<AppStore>,
|
private store: Store<AppStore>,
|
||||||
private config: AppConfigService,
|
private config: AppConfigService,
|
||||||
|
private alfrescoApiService: AlfrescoApiService,
|
||||||
|
private authenticationService: AuthenticationService,
|
||||||
private electronService: ElectronService,
|
private electronService: ElectronService,
|
||||||
private uploadService: UploadService) {
|
private uploadService: UploadService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.alfrescoApiService.getInstance().on('error', (error) => {
|
||||||
|
if (error.status === 401) {
|
||||||
|
if (!this.authenticationService.isLoggedIn()) {
|
||||||
|
this.router.navigate(['/login']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
this.loadAppSettings();
|
this.loadAppSettings();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user