mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
auth service api improvements (#1865)
Rename Auth Service events: - loginSubject -> onLogin - logoutSubject -> onLogout
This commit is contained in:
committed by
Eugenio Romano
parent
4db98a1d7b
commit
130c2e4428
@@ -24,8 +24,9 @@ import { AlfrescoApiService } from './alfresco-api.service';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoAuthenticationService {
|
||||
loginSubject: Subject<any> = new Subject<any>();
|
||||
logoutSubject: Subject<any> = new Subject<any>();
|
||||
|
||||
onLogin: Subject<any> = new Subject<any>();
|
||||
onLogout: Subject<any> = new Subject<any>();
|
||||
|
||||
constructor(private settingsService: AlfrescoSettingsService,
|
||||
public alfrescoApi: AlfrescoApiService,
|
||||
@@ -52,7 +53,7 @@ export class AlfrescoAuthenticationService {
|
||||
return Observable.fromPromise(this.callApiLogin(username, password))
|
||||
.map((response: any) => {
|
||||
this.saveTickets();
|
||||
this.loginSubject.next(response);
|
||||
this.onLogin.next(response);
|
||||
return {type: this.settingsService.getProviders(), ticket: response};
|
||||
})
|
||||
.catch(err => this.handleError(err));
|
||||
@@ -75,10 +76,9 @@ export class AlfrescoAuthenticationService {
|
||||
*/
|
||||
logout() {
|
||||
return Observable.fromPromise(this.callApiLogout())
|
||||
.map(res => <any> res)
|
||||
.do(response => {
|
||||
this.removeTicket();
|
||||
this.logoutSubject.next(response);
|
||||
this.onLogout.next(response);
|
||||
return response;
|
||||
})
|
||||
.catch(err => this.handleError(err));
|
||||
|
Reference in New Issue
Block a user