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);