From 3da38d6e9f8d600476be276666ac7223aa5f172c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 2 Aug 2021 15:29:09 +0200 Subject: Fetch things in bulk for the homepage --- client/src/app/core/rest/rest.service.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'client/src/app/core/rest/rest.service.ts') 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 { return newParams } + addArrayParams (params: HttpParams, name: string, values: (string | number)[]) { + for (const v of values) { + params = params.append(name, v) + } + + return params + } + addObjectParams (params: HttpParams, object: { [ name: string ]: any }) { for (const name of Object.keys(object)) { const value = object[name] if (value === undefined || value === null) continue if (Array.isArray(value)) { - for (const v of value) params = params.append(name, v) + params = this.addArrayParams(params, name, value) } else { params = params.append(name, value) } -- cgit v1.2.3