]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/admin/friends/friend-list/friend-list.component.ts
c76fc4df2e2e6b09acb725decc70cbc9f1bf094c
[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 template: require('./friend-list.component.html'),
8 styles: [ require('./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)
28 );
29 }
30
31 private getFriends() {
32 this.friendService.getFriends().subscribe(
33 friends => this.friends = friends,
34
35 err => alert(err)
36 );
37 }
38 }