diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-02 16:50:56 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-02 17:10:07 +0200 |
commit | ff4de38385049bf8f6e1d76d8511854fcfabc71c (patch) | |
tree | 217dba89333609fc0255c2efbc38c0e7a8379bb8 /client/src/app/shared/shared-main | |
parent | 3da38d6e9f8d600476be276666ac7223aa5f172c (diff) | |
download | PeerTube-ff4de38385049bf8f6e1d76d8511854fcfabc71c.tar.gz PeerTube-ff4de38385049bf8f6e1d76d8511854fcfabc71c.tar.zst PeerTube-ff4de38385049bf8f6e1d76d8511854fcfabc71c.zip |
Filter videos by live in custom markup
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r-- | client/src/app/shared/shared-main/video/video.service.ts | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 04a39be0e..4a97719fa 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -210,15 +210,16 @@ export class VideoService implements VideosProvider { | |||
210 | } | 210 | } |
211 | 211 | ||
212 | getVideos (parameters: { | 212 | getVideos (parameters: { |
213 | videoPagination: ComponentPaginationLight, | 213 | videoPagination: ComponentPaginationLight |
214 | sort: VideoSortField, | 214 | sort: VideoSortField |
215 | filter?: VideoFilter, | 215 | filter?: VideoFilter |
216 | categoryOneOf?: number[], | 216 | categoryOneOf?: number[] |
217 | languageOneOf?: string[], | 217 | languageOneOf?: string[] |
218 | skipCount?: boolean, | 218 | isLive?: boolean |
219 | skipCount?: boolean | ||
219 | nsfwPolicy?: NSFWPolicyType | 220 | nsfwPolicy?: NSFWPolicyType |
220 | }): Observable<ResultList<Video>> { | 221 | }): Observable<ResultList<Video>> { |
221 | const { videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount, nsfwPolicy } = parameters | 222 | const { videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount, nsfwPolicy, isLive } = parameters |
222 | 223 | ||
223 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 224 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
224 | 225 | ||
@@ -228,21 +229,10 @@ export class VideoService implements VideosProvider { | |||
228 | if (filter) params = params.set('filter', filter) | 229 | if (filter) params = params.set('filter', filter) |
229 | if (skipCount) params = params.set('skipCount', skipCount + '') | 230 | if (skipCount) params = params.set('skipCount', skipCount + '') |
230 | 231 | ||
231 | if (nsfwPolicy) { | 232 | if (isLive) params = params.set('isLive', isLive) |
232 | params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) | 233 | if (nsfwPolicy) params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) |
233 | } | 234 | if (languageOneOf) this.restService.addArrayParams(params, 'languageOneOf', languageOneOf) |
234 | 235 | if (categoryOneOf) this.restService.addArrayParams(params, 'categoryOneOf', categoryOneOf) | |
235 | if (languageOneOf) { | ||
236 | for (const l of languageOneOf) { | ||
237 | params = params.append('languageOneOf[]', l) | ||
238 | } | ||
239 | } | ||
240 | |||
241 | if (categoryOneOf) { | ||
242 | for (const c of categoryOneOf) { | ||
243 | params = params.append('categoryOneOf[]', c + '') | ||
244 | } | ||
245 | } | ||
246 | 236 | ||
247 | return this.authHttp | 237 | return this.authHttp |
248 | .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params }) | 238 | .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params }) |