1 import { Subscription } from 'rxjs'
2 import { first, tap } from 'rxjs/operators'
3 import { Component, OnDestroy, OnInit } from '@angular/core'
4 import { ActivatedRoute, Router } from '@angular/router'
5 import { AuthService, ConfirmService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
6 import { immutableAssign } from '@app/helpers'
7 import { Account, AccountService, VideoService } from '@app/shared/shared-main'
8 import { AbstractVideoList } from '@app/shared/shared-video-miniature'
11 selector: 'my-account-videos',
12 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html',
14 '../../shared/shared-video-miniature/abstract-video-list.scss'
17 export class AccountVideosComponent extends AbstractVideoList implements OnInit, OnDestroy {
21 private account: Account
22 private accountSub: Subscription
25 protected router: Router,
26 protected serverService: ServerService,
27 protected route: ActivatedRoute,
28 protected authService: AuthService,
29 protected userService: UserService,
30 protected notifier: Notifier,
31 protected confirmService: ConfirmService,
32 protected screenService: ScreenService,
33 protected storageService: LocalStorageService,
34 private accountService: AccountService,
35 private videoService: VideoService
43 // Parent get the account for us
44 this.accountSub = this.accountService.accountLoaded
46 .subscribe(account => {
47 this.account = account
50 this.generateSyndicationList()
55 if (this.accountSub) this.accountSub.unsubscribe()
60 getVideosObservable (page: number) {
61 const newPagination = immutableAssign(this.pagination, { currentPage: page })
63 return this.videoService
64 .getAccountVideos(this.account, newPagination, this.sort)
67 this.titlePage = $localize`Published ${total} videos`
72 generateSyndicationList () {
73 this.syndicationItems = this.videoService.getAccountFeedUrls(this.account.id)