import { from, Subject, Subscription } from 'rxjs'
import { concatMap, map, switchMap, tap } from 'rxjs/operators'
import { Component, OnDestroy, OnInit } from '@angular/core'
-import { ComponentPagination, hasMoreItems, MarkdownService, ScreenService, User, UserService } from '@app/core'
+import { ComponentPagination, hasMoreItems, MarkdownService, User, UserService } from '@app/core'
import { Account, AccountService, Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'
-import { NSFWPolicyType, VideoSortField } from '@shared/models'
import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature'
+import { NSFWPolicyType, VideoSortField } from '@shared/models'
@Component({
selector: 'my-account-video-channels',
this.accountSub = this.accountService.accountLoaded
.subscribe(account => {
this.account = account
+ this.videoChannels = []
this.loadMoreChannels()
})
this.videoChannelService.listAccountVideoChannels(options)
.pipe(
- tap(res => this.channelPagination.totalItems = res.total),
+ tap(res => {
+ this.channelPagination.totalItems = res.total
+ }),
switchMap(res => from(res.data)),
concatMap(videoChannel => {
const options = {
}
getVideosOf (videoChannel: VideoChannel) {
- const obj = this.videos[ videoChannel.id ]
+ const obj = this.videos[videoChannel.id]
if (!obj) return []
return obj.videos
}
getTotalVideosOf (videoChannel: VideoChannel) {
- const obj = this.videos[ videoChannel.id ]
+ const obj = this.videos[videoChannel.id]
if (!obj) return undefined
return obj.total
}
getVideoChannelLink (videoChannel: VideoChannel) {
- return [ '/video-channels', videoChannel.nameWithHost ]
+ return [ '/c', videoChannel.nameWithHost ]
}
}