|
|
|
@ -2,8 +2,9 @@ import {UserAutocompleterComponent} from "core-app/modules/common/autocomplete/u |
|
|
|
|
import {Observable} from "rxjs"; |
|
|
|
|
import {map} from "rxjs/operators"; |
|
|
|
|
import {InjectField} from "core-app/helpers/angular/inject-field.decorator"; |
|
|
|
|
import {HttpClient} from "@angular/common/http"; |
|
|
|
|
import {HttpClient, HttpParams} from "@angular/common/http"; |
|
|
|
|
import {Component} from "@angular/core"; |
|
|
|
|
import {URLParamsEncoder} from "core-app/modules/hal/services/url-params-encoder"; |
|
|
|
|
|
|
|
|
|
export const membersAutocompleterSelector = 'members-autocompleter'; |
|
|
|
|
|
|
|
|
@ -14,13 +15,15 @@ export const membersAutocompleterSelector = 'members-autocompleter'; |
|
|
|
|
export class MembersAutocompleterComponent extends UserAutocompleterComponent { |
|
|
|
|
@InjectField() http:HttpClient; |
|
|
|
|
|
|
|
|
|
protected getAvailableUsers(url:string, searchTerm:any):Observable<{[key:string]:string|null}[]> { |
|
|
|
|
protected getAvailableUsers(url:string, searchTerm:any):Observable<{ [key:string]:string|null }[]> { |
|
|
|
|
return this.http |
|
|
|
|
.get(url, |
|
|
|
|
{ params: { q: searchTerm }, |
|
|
|
|
{ |
|
|
|
|
params: new HttpParams({ encoder: new URLParamsEncoder(), fromObject: { q: searchTerm } }), |
|
|
|
|
responseType: 'json', |
|
|
|
|
headers: { 'Content-Type': 'application/json; charset=utf-8' }}, |
|
|
|
|
) |
|
|
|
|
headers: { 'Content-Type': 'application/json; charset=utf-8' } |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
.pipe( |
|
|
|
|
map((res:any) => { |
|
|
|
|
return res.results.items.map((el:any) => { |
|
|
|
|