aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/rest
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core/rest')
-rw-r--r--client/src/app/core/rest/rest.service.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/client/src/app/core/rest/rest.service.ts b/client/src/app/core/rest/rest.service.ts
index 1696e6709..98e45ffc0 100644
--- a/client/src/app/core/rest/rest.service.ts
+++ b/client/src/app/core/rest/rest.service.ts
@@ -44,13 +44,21 @@ export class RestService {
44 return newParams 44 return newParams
45 } 45 }
46 46
47 addArrayParams (params: HttpParams, name: string, values: (string | number)[]) {
48 for (const v of values) {
49 params = params.append(name, v)
50 }
51
52 return params
53 }
54
47 addObjectParams (params: HttpParams, object: { [ name: string ]: any }) { 55 addObjectParams (params: HttpParams, object: { [ name: string ]: any }) {
48 for (const name of Object.keys(object)) { 56 for (const name of Object.keys(object)) {
49 const value = object[name] 57 const value = object[name]
50 if (value === undefined || value === null) continue 58 if (value === undefined || value === null) continue
51 59
52 if (Array.isArray(value)) { 60 if (Array.isArray(value)) {
53 for (const v of value) params = params.append(name, v) 61 params = this.addArrayParams(params, name, value)
54 } else { 62 } else {
55 params = params.append(name, value) 63 params = params.append(name, value)
56 } 64 }