mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#878 fix user info demo
This commit is contained in:
@@ -21,6 +21,8 @@ import { AlfrescoSettingsService } from './AlfrescoSettings.service';
|
||||
import { AlfrescoApiService } from './AlfrescoApi.service';
|
||||
import * as alfrescoApi from 'alfresco-js-api';
|
||||
import { AlfrescoApi } from 'alfresco-js-api';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
|
||||
/**
|
||||
* The AlfrescoAuthenticationService provide the login service and store the ticket in the localStorage
|
||||
*/
|
||||
@@ -29,6 +31,10 @@ export class AlfrescoAuthenticationService {
|
||||
|
||||
alfrescoApi: AlfrescoApi;
|
||||
|
||||
public loginSubject: Subject<any> = new Subject<any>();
|
||||
|
||||
public logoutSubject: Subject<any> = new Subject<any>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param settingsService
|
||||
@@ -84,6 +90,7 @@ export class AlfrescoAuthenticationService {
|
||||
return Observable.fromPromise(this.callApiLogin(username, password))
|
||||
.map((response: any) => {
|
||||
this.saveTickets();
|
||||
this.loginSubject.next(response);
|
||||
return {type: this.settingsService.getProviders(), ticket: response};
|
||||
})
|
||||
.catch(this.handleError);
|
||||
@@ -109,6 +116,7 @@ export class AlfrescoAuthenticationService {
|
||||
return Observable.fromPromise(this.callApiLogout())
|
||||
.map(res => <any> res)
|
||||
.do(response => {
|
||||
this.logoutSubject.next(response);
|
||||
return response;
|
||||
})
|
||||
.catch(this.handleError);
|
||||
|
Reference in New Issue
Block a user