aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts')
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts25
1 files changed, 18 insertions, 7 deletions
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
index afa4f4799..d9f77802b 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
@@ -23,6 +23,8 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
23 @Input() onlyDisplayTitle: boolean 23 @Input() onlyDisplayTitle: boolean
24 @Input() filter: VideoFilter 24 @Input() filter: VideoFilter
25 @Input() maxRows: number 25 @Input() maxRows: number
26 @Input() channelHandle: string
27 @Input() accountHandle: string
26 28
27 @Output() loaded = new EventEmitter<boolean>() 29 @Output() loaded = new EventEmitter<boolean>()
28 30
@@ -66,6 +68,16 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
66 } 68 }
67 } 69 }
68 70
71 return this.getVideosObservable()
72 .pipe(finalize(() => this.loaded.emit(true)))
73 .subscribe(
74 ({ data }) => this.videos = data,
75
76 err => this.notifier.error('Error in videos list component: ' + err.message)
77 )
78 }
79
80 getVideosObservable () {
69 const options = { 81 const options = {
70 videoPagination: { 82 videoPagination: {
71 currentPage: 1, 83 currentPage: 1,
@@ -74,15 +86,14 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
74 categoryOneOf: this.categoryOneOf, 86 categoryOneOf: this.categoryOneOf,
75 languageOneOf: this.languageOneOf, 87 languageOneOf: this.languageOneOf,
76 filter: this.filter, 88 filter: this.filter,
77 sort: this.sort as VideoSortField 89 sort: this.sort as VideoSortField,
90 account: { nameWithHost: this.accountHandle },
91 videoChannel: { nameWithHost: this.channelHandle }
78 } 92 }
79 93
80 this.videoService.getVideos(options) 94 if (this.channelHandle) return this.videoService.getVideoChannelVideos(options)
81 .pipe(finalize(() => this.loaded.emit(true))) 95 if (this.accountHandle) return this.videoService.getAccountVideos(options)
82 .subscribe(
83 ({ data }) => this.videos = data,
84 96
85 err => this.notifier.error('Error in videos list component: ' + err.message) 97 return this.videoService.getVideos(options)
86 )
87 } 98 }
88} 99}