diff options
author | Chocobozzz <me@florianbigard.com> | 2022-05-06 14:23:02 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-05-06 14:23:02 +0200 |
commit | f40712abbbb74e51f06037ef02757c42736bccf8 (patch) | |
tree | 4b130c6387f9687d52d570907eb1bbac6bc04b61 /client/src/app/+stats/video/video-stats.service.ts | |
parent | 49f0468d44468528c2fb2c8b0efd19cdaeeec43d (diff) | |
download | PeerTube-f40712abbbb74e51f06037ef02757c42736bccf8.tar.gz PeerTube-f40712abbbb74e51f06037ef02757c42736bccf8.tar.zst PeerTube-f40712abbbb74e51f06037ef02757c42736bccf8.zip |
Add ability to filter overall video stats by date
Diffstat (limited to 'client/src/app/+stats/video/video-stats.service.ts')
-rw-r--r-- | client/src/app/+stats/video/video-stats.service.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/client/src/app/+stats/video/video-stats.service.ts b/client/src/app/+stats/video/video-stats.service.ts index 712d03971..e019c87f7 100644 --- a/client/src/app/+stats/video/video-stats.service.ts +++ b/client/src/app/+stats/video/video-stats.service.ts | |||
@@ -17,8 +17,18 @@ export class VideoStatsService { | |||
17 | private restExtractor: RestExtractor | 17 | private restExtractor: RestExtractor |
18 | ) { } | 18 | ) { } |
19 | 19 | ||
20 | getOverallStats (videoId: string) { | 20 | getOverallStats (options: { |
21 | return this.authHttp.get<VideoStatsOverall>(VideoService.BASE_VIDEO_URL + '/' + videoId + '/stats/overall') | 21 | videoId: string |
22 | startDate?: Date | ||
23 | endDate?: Date | ||
24 | }) { | ||
25 | const { videoId, startDate, endDate } = options | ||
26 | |||
27 | let params = new HttpParams() | ||
28 | if (startDate) params = params.append('startDate', startDate.toISOString()) | ||
29 | if (endDate) params = params.append('endDate', endDate.toISOString()) | ||
30 | |||
31 | return this.authHttp.get<VideoStatsOverall>(VideoService.BASE_VIDEO_URL + '/' + videoId + '/stats/overall', { params }) | ||
22 | .pipe(catchError(err => this.restExtractor.handleError(err))) | 32 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
23 | } | 33 | } |
24 | 34 | ||