blob: 2c6054721315d3d66fb3776156187dd1997e3dd8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
import { Component, OnInit } from '@angular/core'
import { AuthService } from '@app/core'
import { NotificationsService } from 'angular2-notifications'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideosOverview } from '@app/shared/overview/videos-overview.model'
import { OverviewService } from '@app/shared/overview'
import { Video } from '@app/shared/video/video.model'
@Component({
selector: 'my-video-overview',
templateUrl: './video-overview.component.html',
styleUrls: [ './video-overview.component.scss' ]
})
export class VideoOverviewComponent implements OnInit {
overview: VideosOverview = {
categories: [],
channels: [],
tags: []
}
notResults = false
constructor (
private i18n: I18n,
private notificationsService: NotificationsService,
private authService: AuthService,
private overviewService: OverviewService
) { }
get user () {
return this.authService.getUser()
}
ngOnInit () {
this.overviewService.getVideosOverview()
.subscribe(
overview => {
this.overview = overview
if (
this.overview.categories.length === 0 &&
this.overview.channels.length === 0 &&
this.overview.tags.length === 0
) this.notResults = true
},
err => {
console.log(err)
this.notificationsService.error('Error', err.text)
}
)
}
buildVideoChannelBy (object: { videos: Video[] }) {
return object.videos[0].byVideoChannel
}
buildVideoChannelAvatarUrl (object: { videos: Video[] }) {
return object.videos[0].videoChannelAvatarUrl
}
}
|