diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-23 22:32:43 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-23 22:32:43 +0100 |
commit | b99290b1d5d736083513fb8f66e91f61bfe07e0b (patch) | |
tree | e0e7fa738ee661a267f5330db35bc46d295f945f /client/src/app/+admin/friends/friend-list/friend-list.component.ts | |
parent | 11ac88de40215783835cf6e6259ff0f6cee258dd (diff) | |
download | PeerTube-b99290b1d5d736083513fb8f66e91f61bfe07e0b.tar.gz PeerTube-b99290b1d5d736083513fb8f66e91f61bfe07e0b.tar.zst PeerTube-b99290b1d5d736083513fb8f66e91f61bfe07e0b.zip |
Client: lazy load admin area
Diffstat (limited to 'client/src/app/+admin/friends/friend-list/friend-list.component.ts')
-rw-r--r-- | client/src/app/+admin/friends/friend-list/friend-list.component.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/client/src/app/+admin/friends/friend-list/friend-list.component.ts b/client/src/app/+admin/friends/friend-list/friend-list.component.ts new file mode 100644 index 000000000..bec10162c --- /dev/null +++ b/client/src/app/+admin/friends/friend-list/friend-list.component.ts | |||
@@ -0,0 +1,38 @@ | |||
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 | } | ||