From 532dd2a2440f80a0eb03d0f21e97b99492eca57c Mon Sep 17 00:00:00 2001 From: Will Abson Date: Mon, 6 Jun 2016 15:58:42 +0100 Subject: [PATCH] Fix search demo for non-default repo hostnames --- .../ng2-alfresco-search/src/services/alfresco.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ng2-components/ng2-alfresco-search/src/services/alfresco.service.ts b/ng2-components/ng2-alfresco-search/src/services/alfresco.service.ts index c6583362ba..f7e7c02ebd 100644 --- a/ng2-components/ng2-alfresco-search/src/services/alfresco.service.ts +++ b/ng2-components/ng2-alfresco-search/src/services/alfresco.service.ts @@ -30,11 +30,9 @@ declare let AlfrescoApi: any; export class AlfrescoService { private _baseUrlPath: string = '/alfresco/api/-default-/public/alfresco/versions/1'; - private _alfrescoClient; constructor(private http: Http, private settings: AlfrescoSettingsService) { - this._alfrescoClient = AlfrescoApi.getClientWithTicket(this.getBaseUrl(), this.getAlfrescoTicket()); } public getHost(): string { @@ -49,8 +47,12 @@ export class AlfrescoService { return localStorage.getItem('token'); } + private getAlfrescoClient() { + return AlfrescoApi.getClientWithTicket(this.getBaseUrl(), this.getAlfrescoTicket()); + } + private getSearchNodesPromise(term: string) { - let apiInstance = new AlfrescoApi.Core.SearchApi(this._alfrescoClient); + let apiInstance = new AlfrescoApi.Core.SearchApi(this.getAlfrescoClient()); let nodeId = '-root-'; let opts = { include: ['path'],