From f37dc0dd14d9ce0b59c454c2c1b935fcbe9727e9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 23 Aug 2018 17:58:39 +0200 Subject: Add ability to search video channels --- client/src/app/shared/rest/rest.service.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'client/src/app/shared/rest/rest.service.ts') 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 { return newParams } + addObjectParams (params: HttpParams, object: object) { + 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 -- cgit v1.2.3