mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
committed by
Eugenio Romano
parent
016e786531
commit
b158afef2b
@@ -87,7 +87,7 @@
|
||||
<md-icon>info_outline</md-icon>
|
||||
<span>About</span>
|
||||
</a>
|
||||
<button md-menu-item (click)="onLogout($event)">
|
||||
<button md-menu-item adf-logout>
|
||||
<md-icon>exit_to_app</md-icon>
|
||||
<span>Logout</span>
|
||||
</button>
|
||||
|
@@ -16,14 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import {
|
||||
AlfrescoAuthenticationService,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoTranslationService,
|
||||
LogService,
|
||||
StorageService
|
||||
} from 'ng2-alfresco-core';
|
||||
import { AlfrescoSettingsService, AlfrescoTranslationService, StorageService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-app',
|
||||
@@ -34,12 +27,9 @@ import {
|
||||
export class AppComponent {
|
||||
searchTerm: string = '';
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private router: Router,
|
||||
private settingsService: AlfrescoSettingsService,
|
||||
constructor(private settingsService: AlfrescoSettingsService,
|
||||
private translateService: AlfrescoTranslationService,
|
||||
private storage: StorageService,
|
||||
private logService: LogService) {
|
||||
private storage: StorageService) {
|
||||
this.setProvider();
|
||||
}
|
||||
|
||||
@@ -47,28 +37,6 @@ export class AppComponent {
|
||||
return location.pathname === '/login' || location.pathname === '/settings';
|
||||
}
|
||||
|
||||
onLogout(event) {
|
||||
event.preventDefault();
|
||||
this.authService.logout()
|
||||
.subscribe(
|
||||
() => {
|
||||
this.navigateToLogin();
|
||||
},
|
||||
(error: any) => {
|
||||
if (error && error.response && error.response.status === 401) {
|
||||
this.navigateToLogin();
|
||||
} else {
|
||||
this.logService.error('An unknown error occurred while logging out', error);
|
||||
this.navigateToLogin();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
navigateToLogin() {
|
||||
this.router.navigate(['/login']);
|
||||
}
|
||||
|
||||
changeLanguage(lang: string) {
|
||||
this.translateService.use(lang);
|
||||
}
|
||||
|
Reference in New Issue
Block a user