[33115] Escape uriComponent in members autocompleter

https://community.openproject.com/wp/33115
pull/8298/head
Oliver Günther 5 years ago
parent 8111fedf2f
commit de19148754
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 13
      frontend/src/app/modules/members/members-autocompleter.component.ts

@ -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) => {

Loading…
Cancel
Save