mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Remove deprecated use of getAlfrescoApi() #1094
remove getAlfrescoApi from auth #1094
This commit is contained in:
@@ -88,7 +88,7 @@ describe('AlfrescoAuthentication', () => {
|
||||
authService.login('fake-username', 'fake-password').subscribe(() => {
|
||||
expect(authService.isLoggedIn()).toBe(true);
|
||||
expect(authService.getTicketBpm()).toBeNull();
|
||||
expect(authService.getAlfrescoApi().bpmAuth.isLoggedIn()).toBeFalsy();
|
||||
expect(authService.alfrescoApi.bpmAuth.isLoggedIn()).toBeFalsy();
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -187,7 +187,7 @@ describe('AlfrescoAuthentication', () => {
|
||||
authService.login('fake-username', 'fake-password').subscribe(() => {
|
||||
expect(authService.isLoggedIn()).toBe(true);
|
||||
expect(authService.getTicketEcm()).toBeNull();
|
||||
expect(authService.getAlfrescoApi().ecmAuth.isLoggedIn()).toBeFalsy();
|
||||
expect(authService.alfrescoApi.ecmAuth.isLoggedIn()).toBeFalsy();
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -258,19 +258,19 @@ describe('AlfrescoAuthentication', () => {
|
||||
it('should host ecm url change be reflected in the api configuration', () => {
|
||||
settingsService.ecmHost = '127.99.99.99';
|
||||
|
||||
expect(authService.getAlfrescoApi().config.hostEcm).toBe('127.99.99.99');
|
||||
expect(authService.alfrescoApi.config.hostEcm).toBe('127.99.99.99');
|
||||
});
|
||||
|
||||
it('should host bpm url change be reflected in the api configuration', () => {
|
||||
settingsService.bpmHost = '127.99.99.99';
|
||||
|
||||
expect(authService.getAlfrescoApi().config.hostBpm).toBe('127.99.99.99');
|
||||
expect(authService.alfrescoApi.config.hostBpm).toBe('127.99.99.99');
|
||||
});
|
||||
|
||||
it('should host bpm provider change be reflected in the api configuration', () => {
|
||||
settingsService.setProviders('ECM');
|
||||
|
||||
expect(authService.getAlfrescoApi().config.provider).toBe('ECM');
|
||||
expect(authService.alfrescoApi.config.provider).toBe('ECM');
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -221,8 +221,4 @@ export class AlfrescoAuthenticationService {
|
||||
console.error('Error when logging in', error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
getAlfrescoApi(): any {
|
||||
return this.alfrescoApi;
|
||||
}
|
||||
}
|
||||
|
@@ -18,11 +18,12 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { AlfrescoAuthenticationService } from './AlfrescoAuthentication.service';
|
||||
import { AlfrescoApiService } from './AlfrescoApi.service';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoContentService {
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService) {
|
||||
constructor(public authService: AlfrescoAuthenticationService, public apiService: AlfrescoApiService) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +32,7 @@ export class AlfrescoContentService {
|
||||
* @returns {string} URL address.
|
||||
*/
|
||||
getDocumentThumbnailUrl(document: any): string {
|
||||
return this.authService.getAlfrescoApi().content.getDocumentThumbnailUrl(document.entry.id);
|
||||
return this.apiService.getInstance().content.getDocumentThumbnailUrl(document.entry.id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,6 +41,6 @@ export class AlfrescoContentService {
|
||||
* @returns {string} URL address.
|
||||
*/
|
||||
getContentUrl(document: any): string {
|
||||
return this.authService.getAlfrescoApi().content.getContentUrl(document.entry.id);
|
||||
return this.apiService.getInstance().content.getContentUrl(document.entry.id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user