1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { Location } from '@angular/common'
4 import { immutableAssign } from '@app/shared/misc/utils'
5 import { NotificationsService } from 'angular2-notifications'
6 import { AuthService } from '../../core/auth'
7 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
8 import { VideoSortField } from '../../shared/video/sort-field.type'
9 import { VideoService } from '../../shared/video/video.service'
12 selector: 'my-videos-recently-added',
13 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
14 templateUrl: '../../shared/video/abstract-video-list.html'
16 export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
17 titlePage = 'Recently added'
18 currentRoute = '/videos/recently-added'
19 sort: VideoSortField = '-publishedAt'
21 constructor (protected router: Router,
22 protected route: ActivatedRoute,
23 protected location: Location,
24 protected notificationsService: NotificationsService,
25 protected authService: AuthService,
26 private videoService: VideoService) {
33 this.generateSyndicationList()
40 getVideosObservable (page: number) {
41 const newPagination = immutableAssign(this.pagination, { currentPage: page })
43 return this.videoService.getVideos(newPagination, this.sort)
46 generateSyndicationList () {
47 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort)