]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/rest/rest.service.ts
Better spacing beetween comments
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / rest / rest.service.ts
index 5d5410de98c50deb1345f08b1051937182c66c16..e6d4e6e5e1cb4ba981ce901c95aecd472eead101 100644 (file)
@@ -32,6 +32,21 @@ export class RestService {
     return newParams
   }
 
+  addObjectParams (params: HttpParams, object: { [ name: string ]: any }) {
+    for (const name of Object.keys(object)) {
+      const value = object[name]
+      if (!value) continue
+
+      if (Array.isArray(value) && value.length !== 0) {
+        for (const v of value) params = params.append(name, v)
+      } else {
+        params = params.append(name, value)
+      }
+    }
+
+    return params
+  }
+
   componentPaginationToRestPagination (componentPagination: ComponentPagination): RestPagination {
     const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage
     const count: number = componentPagination.itemsPerPage