1 import { Component, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { immutableAssign } from '@app/shared/misc/utils'
4 import { NotificationsService } from 'angular2-notifications'
5 import { AuthService } from '../../core/auth'
6 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7 import { SortField } from '../../shared/video/sort-field.type'
8 import { VideoService } from '../../shared/video/video.service'
11 selector: 'my-videos-recently-added',
12 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
13 templateUrl: '../../shared/video/abstract-video-list.html'
15 export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit {
16 titlePage = 'Recently added'
17 currentRoute = '/videos/recently-added'
18 sort: SortField = '-createdAt'
20 constructor (protected router: Router,
21 protected route: ActivatedRoute,
22 protected notificationsService: NotificationsService,
23 protected authService: AuthService,
24 private videoService: VideoService) {
32 getVideosObservable (page: number) {
33 const newPagination = immutableAssign(this.pagination, { currentPage: page })
35 return this.videoService.getVideos(newPagination, this.sort)