categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [],
languageOneOf: this.buildArrayString(data.languageOneOf) ?? [],
+ accountHandle: data.accountHandle || undefined,
+ channelHandle: data.channelHandle || undefined,
+
filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined
}
@Input() onlyDisplayTitle: boolean
@Input() filter: VideoFilter
@Input() maxRows: number
+ @Input() channelHandle: string
+ @Input() accountHandle: string
@Output() loaded = new EventEmitter<boolean>()
}
}
+ return this.getVideosObservable()
+ .pipe(finalize(() => this.loaded.emit(true)))
+ .subscribe(
+ ({ data }) => this.videos = data,
+
+ err => this.notifier.error('Error in videos list component: ' + err.message)
+ )
+ }
+
+ getVideosObservable () {
const options = {
videoPagination: {
currentPage: 1,
categoryOneOf: this.categoryOneOf,
languageOneOf: this.languageOneOf,
filter: this.filter,
- sort: this.sort as VideoSortField
+ sort: this.sort as VideoSortField,
+ account: { nameWithHost: this.accountHandle },
+ videoChannel: { nameWithHost: this.channelHandle }
}
- this.videoService.getVideos(options)
- .pipe(finalize(() => this.loaded.emit(true)))
- .subscribe(
- ({ data }) => this.videos = data,
+ if (this.channelHandle) return this.videoService.getVideoChannelVideos(options)
+ if (this.accountHandle) return this.videoService.getAccountVideos(options)
- err => this.notifier.error('Error in videos list component: ' + err.message)
- )
+ return this.videoService.getVideos(options)
}
}
}
getAccountVideos (parameters: {
- account: Account,
+ account: Pick<Account, 'nameWithHost'>,
videoPagination: ComponentPaginationLight,
sort: VideoSortField
nsfwPolicy?: NSFWPolicyType
}
getVideoChannelVideos (parameters: {
- videoChannel: VideoChannel,
+ videoChannel: Pick<VideoChannel, 'nameWithHost'>,
videoPagination: ComponentPaginationLight,
sort: VideoSortField,
nsfwPolicy?: NSFWPolicyType