aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-03-11 14:39:28 +0100
committerChocobozzz <me@florianbigard.com>2020-03-11 15:02:20 +0100
commit764a965778ac89e027fd05dd35697c6763e0dc18 (patch)
treeecc18834566b940c729a57b5bf0d088e894f03d3 /shared/extra-utils
parentfab6746354f9d9cb65c35d8bd9352c4b773b4c69 (diff)
downloadPeerTube-764a965778ac89e027fd05dd35697c6763e0dc18.tar.gz
PeerTube-764a965778ac89e027fd05dd35697c6763e0dc18.tar.zst
PeerTube-764a965778ac89e027fd05dd35697c6763e0dc18.zip
Implement pagination for overviews endpoint
Diffstat (limited to 'shared/extra-utils')
-rw-r--r--shared/extra-utils/overviews/overviews.ts27
1 files changed, 21 insertions, 6 deletions
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 @@
1import { makeGetRequest } from '../requests/requests' 1import { makeGetRequest } from '../requests/requests'
2 2
3function getVideosOverview (url: string, useCache = false) { 3function getVideosOverview (url: string, page: number, statusCodeExpected = 200) {
4 const path = '/api/v1/overviews/videos' 4 const path = '/api/v1/overviews/videos'
5 5
6 const query = { 6 const query = { page }
7 t: useCache ? undefined : new Date().getTime()
8 }
9 7
10 return makeGetRequest({ 8 return makeGetRequest({
11 url, 9 url,
12 path, 10 path,
13 query, 11 query,
14 statusCodeExpected: 200 12 statusCodeExpected
15 }) 13 })
16} 14}
17 15
18export { getVideosOverview } 16function getVideosOverviewWithToken (url: string, page: number, token: string, statusCodeExpected = 200) {
17 const path = '/api/v1/overviews/videos'
18
19 const query = { page }
20
21 return makeGetRequest({
22 url,
23 path,
24 query,
25 token,
26 statusCodeExpected
27 })
28}
29
30export {
31 getVideosOverview,
32 getVideosOverviewWithToken
33}