Improved test readibility and code

This commit is contained in:
Vito Albano
2016-10-12 17:12:00 +01:00
parent 1037385295
commit 90332daa64
12 changed files with 289 additions and 400 deletions

View File

@@ -38,7 +38,7 @@ export class BpmUserService {
*/
getCurrentUserInfo(): Observable<BpmUserModel> {
if ( this.authService.isBpmLoggedIn() ) {
return Observable.fromPromise(this.callApiGetProfile())
return Observable.fromPromise(this.authService.getAlfrescoApi().activiti.profileApi.getProfilePicture())
.map(
(data) => <BpmUserModel> data
)
@@ -46,9 +46,9 @@ export class BpmUserService {
}
}
getCurrentUserProfileImage(): any {
getCurrentUserProfileImage(): Observable<any> {
if ( this.authService.isBpmLoggedIn() ) {
return Observable.fromPromise(this.callApiGetProfilePicture())
return Observable.fromPromise(this.authService.getAlfrescoApi().activiti.profileApi.getProfile())
.map(
(data) => data
)
@@ -56,25 +56,6 @@ export class BpmUserService {
}
}
/**
* Call js api to get current user profile picture
*/
callApiGetProfilePicture() {
try {
return this.authService.getAlfrescoApi().activiti.profileApi.getProfilePicture();
} catch (exc) {
console.error(exc);
return null;
}
}
/**
* Call js api to get current user information
*/
callApiGetProfile() {
return this.authService.getAlfrescoApi().activiti.profileApi.getProfile();
}
/**
* Throw the error
* @param error