Remove deprecated use of getAlfrescoApi() #1094

remove getAlfrescoApi from auth #1094
This commit is contained in:
Eugenio Romano
2016-11-28 14:04:58 +00:00
parent eed6902428
commit d87a768d20
18 changed files with 73 additions and 74 deletions

View File

@@ -25,7 +25,7 @@ declare let jasmine: any;
describe('AlfrescoSearchService', () => {
let service: AlfrescoSearchService;
let authenticationService: AlfrescoAuthenticationService;
let apiService: AlfrescoApiService;
let injector: ReflectiveInjector;
beforeEach(() => {
@@ -36,8 +36,8 @@ describe('AlfrescoSearchService', () => {
AlfrescoAuthenticationService
]);
service = injector.get(AlfrescoSearchService);
authenticationService = injector.get(AlfrescoAuthenticationService);
spyOn(authenticationService, 'getAlfrescoApi').and.returnValue(fakeApi);
apiService = injector.get(AlfrescoApiService);
spyOn(apiService, 'getInstance').and.returnValue(fakeApi);
});
it('should call search API with no additional options', (done) => {

View File

@@ -17,7 +17,7 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
import { AlfrescoAuthenticationService, AlfrescoApiService } from 'ng2-alfresco-core';
/**
* Internal service used by Document List component.
@@ -25,7 +25,7 @@ import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
@Injectable()
export class AlfrescoSearchService {
constructor(private authService: AlfrescoAuthenticationService) {
constructor(public authService: AlfrescoAuthenticationService, private apiService: AlfrescoApiService) {
}
/**
@@ -42,7 +42,7 @@ export class AlfrescoSearchService {
}
private getQueryNodesPromise(term: string, opts: SearchOptions) {
return this.authService.getAlfrescoApi().core.queriesApi.findNodes(term, opts);
return this.apiService.getInstance().core.queriesApi.findNodes(term, opts);
}
private handleError(error: any): Observable<any> {