Fix undefined param submit for GET users

pull/46/head
HardiReady 2018-10-20 08:48:50 +02:00
parent 229b133777
commit 0c04cd7f8f
1 changed files with 10 additions and 6 deletions

View File

@ -21,11 +21,17 @@ export class UserService {
} }
findUsers(filter, limit?, offset?, action = LOAD): Observable<User[]> { findUsers(filter, limit?, offset?, action = LOAD): Observable<User[]> {
let searchParams = new HttpParams().append('q', (filter && filter.query) ? filter.query : '') let searchParams = new HttpParams();
.append('limit', limit) if (limit) {
.append('offset', offset); searchParams = searchParams.append('limit', limit);
}
if (offset) {
searchParams = searchParams.append('offset', offset);
}
if (filter) { if (filter) {
if (filter.query) {
searchParams = searchParams.append('q', filter.query);
}
if (filter.fraction) { if (filter.fraction) {
searchParams = searchParams.append('fractFilter', filter.fraction); searchParams = searchParams.append('fractFilter', filter.fraction);
} }
@ -37,7 +43,6 @@ export class UserService {
} }
} }
this.httpGateway.get<Response>(this.config.apiUserPath, searchParams, true) this.httpGateway.get<Response>(this.config.apiUserPath, searchParams, true)
.do((res) => { .do((res) => {
const headerCount = parseInt(res.headers.get('x-total-count'), 10); const headerCount = parseInt(res.headers.get('x-total-count'), 10);
@ -47,7 +52,6 @@ export class UserService {
}) })
.map(res => res.body) .map(res => res.body)
.do((users) => { .do((users) => {
console.log(users)
this.userStore.dispatch({type: action, data: users}); this.userStore.dispatch({type: action, data: users});
}).subscribe(_ => { }).subscribe(_ => {
}); });