From 111fdc267b36201cf1be1fdf91017005102b4a5e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 11 Mar 2020 16:41:38 +0100 Subject: Handle overview pagination in client --- client/src/app/core/server/server.service.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'client/src/app/core') diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index e015d0e14..da7832b32 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -263,17 +263,19 @@ export class ServerService { .pipe(map(data => ({ data, translations }))) }), map(({ data, translations }) => { - const hashToPopulate: VideoConstant[] = [] - - Object.keys(data) - .forEach(dataKey => { - const label = data[ dataKey ] - - hashToPopulate.push({ - id: (attributeName === 'languages' ? dataKey : parseInt(dataKey, 10)) as T, - label: peertubeTranslate(label, translations) - }) - }) + const hashToPopulate: VideoConstant[] = Object.keys(data) + .map(dataKey => { + const label = data[ dataKey ] + + const id = attributeName === 'languages' + ? dataKey as T + : parseInt(dataKey, 10) as T + + return { + id, + label: peertubeTranslate(label, translations) + } + }) if (sort === true) sortBy(hashToPopulate, 'label') -- cgit v1.2.3