From f031683a9a4772d94df2c664930c801e8219bf66 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Fri, 10 Nov 2017 12:54:15 +0200 Subject: [PATCH] -- --- .../autocomplete-remote.component.ts | 24 +++++++++---------- dmp-frontend/src/app/services/rest-base.ts | 4 +++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dmp-frontend/src/app/form/fields/autocomplete-remote/autocomplete-remote.component.ts b/dmp-frontend/src/app/form/fields/autocomplete-remote/autocomplete-remote.component.ts index 6bc3516de..d02b448f9 100644 --- a/dmp-frontend/src/app/form/fields/autocomplete-remote/autocomplete-remote.component.ts +++ b/dmp-frontend/src/app/form/fields/autocomplete-remote/autocomplete-remote.component.ts @@ -49,19 +49,17 @@ export class AutocompleteRemoteComponent implements OnInit, ControlValueAccessor updateByQuery(query : string){ - if(query){ - this.serverService.getThroughProxy(this.url, query).subscribe( - response => { - this.values.length = 0; //clear array; -- this is quite a fast and memory efficient way - response.data.forEach(element => { - this.values.push(element.attributes.name); - }); - }, - error => { - console.log(error); - } - ); - } + this.serverService.getThroughProxy(this.url, query).subscribe( + response => { + this.values.length = 0; //clear array; -- this is quite a fast and memory efficient way + response.data.forEach(element => { + this.values.push(element.attributes.name); + }); + }, + error => { + console.log(error); + } + ); } diff --git a/dmp-frontend/src/app/services/rest-base.ts b/dmp-frontend/src/app/services/rest-base.ts index 98b350e52..981357da9 100644 --- a/dmp-frontend/src/app/services/rest-base.ts +++ b/dmp-frontend/src/app/services/rest-base.ts @@ -48,9 +48,11 @@ export class RestBase { public proxy_get_wQuery(path : string, query: string, params? : any){ var options = this.createOptions(params); - return this.http.get(this.proxyPath +"proxy?url="+ path+"?search="+query, options); + var queryPart = (query) ? "?search="+query : ""; + return this.http.get(this.proxyPath +"proxy?url=" + path + queryPart, options); } + public login(path : string, data : any){ let options = { headers: new HttpHeaders().set('Content-Type', 'application/json') }; return this.http.post(this.loginPath + path, JSON.stringify(data), options);