]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/admin/friends/friend-list/friend-list.component.ts
Server: add video abuse support
[github/Chocobozzz/PeerTube.git] / client / src / app / admin / friends / friend-list / friend-list.component.ts
1 import { Component, OnInit } from '@angular/core';
2
3 import { Friend, FriendService } from '../shared';
4
5 @Component({
6 selector: 'my-friend-list',
7 templateUrl: './friend-list.component.html',
8 styleUrls: [ './friend-list.component.scss' ]
9 })
10 export class FriendListComponent implements OnInit {
11 friends: Friend[];
12
13 constructor(private friendService: FriendService) { }
14
15 ngOnInit() {
16 this.getFriends();
17 }
18
19 quitFriends() {
20 if (!confirm('Are you sure?')) return;
21
22 this.friendService.quitFriends().subscribe(
23 status => {
24 alert('Quit friends!');
25 this.getFriends();
26 },
27 error => alert(error.text)
28 );
29 }
30
31 private getFriends() {
32 this.friendService.getFriends().subscribe(
33 res => this.friends = res.friends,
34
35 err => alert(err.text)
36 );
37 }
38 }