From 764a965778ac89e027fd05dd35697c6763e0dc18 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 11 Mar 2020 14:39:28 +0100 Subject: Implement pagination for overviews endpoint --- shared/extra-utils/overviews/overviews.ts | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'shared/extra-utils/overviews') diff --git a/shared/extra-utils/overviews/overviews.ts b/shared/extra-utils/overviews/overviews.ts index 23e3ceb1e..ae4d31aa3 100644 --- a/shared/extra-utils/overviews/overviews.ts +++ b/shared/extra-utils/overviews/overviews.ts @@ -1,18 +1,33 @@ import { makeGetRequest } from '../requests/requests' -function getVideosOverview (url: string, useCache = false) { +function getVideosOverview (url: string, page: number, statusCodeExpected = 200) { const path = '/api/v1/overviews/videos' - const query = { - t: useCache ? undefined : new Date().getTime() - } + const query = { page } return makeGetRequest({ url, path, query, - statusCodeExpected: 200 + statusCodeExpected }) } -export { getVideosOverview } +function getVideosOverviewWithToken (url: string, page: number, token: string, statusCodeExpected = 200) { + const path = '/api/v1/overviews/videos' + + const query = { page } + + return makeGetRequest({ + url, + path, + query, + token, + statusCodeExpected + }) +} + +export { + getVideosOverview, + getVideosOverviewWithToken +} -- cgit v1.2.3