diff options
Diffstat (limited to 'client/src/app/+admin/friends/friend-list')
-rw-r--r-- | client/src/app/+admin/friends/friend-list/friend-list.component.ts | 21 |
1 files changed, 14 insertions, 7 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 index 700ea7a69..175ad9cba 100644 --- a/client/src/app/+admin/friends/friend-list/friend-list.component.ts +++ b/client/src/app/+admin/friends/friend-list/friend-list.component.ts | |||
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; | |||
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications'; | 3 | import { NotificationsService } from 'angular2-notifications'; |
4 | 4 | ||
5 | import { ConfirmService } from '../../../core'; | ||
5 | import { Friend, FriendService } from '../shared'; | 6 | import { Friend, FriendService } from '../shared'; |
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
@@ -14,6 +15,7 @@ export class FriendListComponent implements OnInit { | |||
14 | 15 | ||
15 | constructor( | 16 | constructor( |
16 | private notificationsService: NotificationsService, | 17 | private notificationsService: NotificationsService, |
18 | private confirmService: ConfirmService, | ||
17 | private friendService: FriendService | 19 | private friendService: FriendService |
18 | ) { } | 20 | ) { } |
19 | 21 | ||
@@ -22,16 +24,21 @@ export class FriendListComponent implements OnInit { | |||
22 | } | 24 | } |
23 | 25 | ||
24 | quitFriends() { | 26 | quitFriends() { |
25 | if (!confirm('Are you sure?')) return; | 27 | const confirmMessage = 'Do you really want to quit your friends? All their videos will be deleted.'; |
28 | this.confirmService.confirm(confirmMessage, 'Quit friends').subscribe( | ||
29 | res => { | ||
30 | if (res === false) return; | ||
26 | 31 | ||
27 | this.friendService.quitFriends().subscribe( | 32 | this.friendService.quitFriends().subscribe( |
28 | status => { | 33 | status => { |
29 | this.notificationsService.success('Sucess', 'Friends left!'); | 34 | this.notificationsService.success('Sucess', 'Friends left!'); |
30 | 35 | ||
31 | this.getFriends(); | 36 | this.getFriends(); |
32 | }, | 37 | }, |
33 | 38 | ||
34 | err => this.notificationsService.error('Error', err.text) | 39 | err => this.notificationsService.error('Error', err.text) |
40 | ); | ||
41 | } | ||
35 | ); | 42 | ); |
36 | } | 43 | } |
37 | 44 | ||