aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-02 15:29:09 +0200
committerChocobozzz <me@florianbigard.com>2021-08-02 15:40:09 +0200
commit3da38d6e9f8d600476be276666ac7223aa5f172c (patch)
treedaec25cccb900a0f90fc9d2273099683b42d8551 /client/src/app/core
parent200eaf5152ca72fe6b05a49caf819e22bd045b37 (diff)
downloadPeerTube-3da38d6e9f8d600476be276666ac7223aa5f172c.tar.gz
PeerTube-3da38d6e9f8d600476be276666ac7223aa5f172c.tar.zst
PeerTube-3da38d6e9f8d600476be276666ac7223aa5f172c.zip
Fetch things in bulk for the homepage
Diffstat (limited to 'client/src/app/core')
-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 }