aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
blob: cfd9151b08050811ba4b731b5a4f4fbaa3784c90 (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
import { Component, OnInit } from '@angular/core';

import { NotificationsService } from 'angular2-notifications';

import { VideoAbuseService, VideoAbuse} from '../../../shared';

@Component({
	selector: 'my-video-abuse-list',
	templateUrl: './video-abuse-list.component.html',
  styleUrls: [ './video-abuse-list.component.scss' ]
})
export class VideoAbuseListComponent implements OnInit {
  videoAbuses: VideoAbuse[];

  constructor(
    private notificationsService: NotificationsService,
    private videoAbuseService: VideoAbuseService
  ) {  }

  ngOnInit() {
    this.getVideoAbuses();
  }

  buildVideoLink(videoAbuse: VideoAbuse) {
    return `/videos/${videoAbuse.videoId}`;
  }

  private getVideoAbuses() {
    this.videoAbuseService.getVideoAbuses().subscribe(
      res => this.videoAbuses = res.videoAbuses,

      err => this.notificationsService.error('Error', err.text)
    );
  }
}