diff options
Diffstat (limited to 'client/src/app/shared/rest')
-rw-r--r-- | client/src/app/shared/rest/rest.service.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/client/src/app/shared/rest/rest.service.ts b/client/src/app/shared/rest/rest.service.ts index 5d5410de9..4560c2024 100644 --- a/client/src/app/shared/rest/rest.service.ts +++ b/client/src/app/shared/rest/rest.service.ts | |||
@@ -32,6 +32,21 @@ export class RestService { | |||
32 | return newParams | 32 | return newParams |
33 | } | 33 | } |
34 | 34 | ||
35 | addObjectParams (params: HttpParams, object: object) { | ||
36 | for (const name of Object.keys(object)) { | ||
37 | const value = object[name] | ||
38 | if (!value) continue | ||
39 | |||
40 | if (Array.isArray(value) && value.length !== 0) { | ||
41 | for (const v of value) params = params.append(name, v) | ||
42 | } else { | ||
43 | params = params.append(name, value) | ||
44 | } | ||
45 | } | ||
46 | |||
47 | return params | ||
48 | } | ||
49 | |||
35 | componentPaginationToRestPagination (componentPagination: ComponentPagination): RestPagination { | 50 | componentPaginationToRestPagination (componentPagination: ComponentPagination): RestPagination { |
36 | const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage | 51 | const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage |
37 | const count: number = componentPagination.itemsPerPage | 52 | const count: number = componentPagination.itemsPerPage |