aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/friends/friend-add
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-27 16:54:44 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-27 16:59:56 +0100
commit5769e1db8d3d5a1e3baa8dff23090cfe93d48a50 (patch)
treeacbb14fda82b7517734f22d4ca57fb5e1ff9ef04 /client/src/app/+admin/friends/friend-add
parent7ddd02c9b8c1e088f6679a2227f105e6439fc992 (diff)
downloadPeerTube-5769e1db8d3d5a1e3baa8dff23090cfe93d48a50.tar.gz
PeerTube-5769e1db8d3d5a1e3baa8dff23090cfe93d48a50.tar.zst
PeerTube-5769e1db8d3d5a1e3baa8dff23090cfe93d48a50.zip
Client: better confirm box for a beautiful world
Diffstat (limited to 'client/src/app/+admin/friends/friend-add')
-rw-r--r--client/src/app/+admin/friends/friend-add/friend-add.component.ts22
1 files changed, 14 insertions, 8 deletions
diff --git a/client/src/app/+admin/friends/friend-add/friend-add.component.ts b/client/src/app/+admin/friends/friend-add/friend-add.component.ts
index a271970ae..12c46e5cd 100644
--- a/client/src/app/+admin/friends/friend-add/friend-add.component.ts
+++ b/client/src/app/+admin/friends/friend-add/friend-add.component.ts
@@ -4,6 +4,7 @@ import { Router } from '@angular/router';
4 4
5import { NotificationsService } from 'angular2-notifications'; 5import { NotificationsService } from 'angular2-notifications';
6 6
7import { ConfirmService } from '../../../core';
7import { validateHost } from '../../../shared'; 8import { validateHost } from '../../../shared';
8import { FriendService } from '../shared'; 9import { FriendService } from '../shared';
9 10
@@ -20,6 +21,7 @@ export class FriendAddComponent implements OnInit {
20 constructor( 21 constructor(
21 private router: Router, 22 private router: Router,
22 private notificationsService: NotificationsService, 23 private notificationsService: NotificationsService,
24 private confirmService: ConfirmService,
23 private friendService: FriendService 25 private friendService: FriendService
24 ) {} 26 ) {}
25 27
@@ -84,16 +86,20 @@ export class FriendAddComponent implements OnInit {
84 return; 86 return;
85 } 87 }
86 88
87 const confirmMessage = 'Are you sure to make friends with:\n - ' + notEmptyHosts.join('\n - '); 89 const confirmMessage = 'Are you sure to make friends with:<br /> - ' + notEmptyHosts.join('<br /> - ');
88 if (!confirm(confirmMessage)) return; 90 this.confirmService.confirm(confirmMessage, 'Make friends').subscribe(
91 res => {
92 if (res === false) return;
89 93
90 this.friendService.makeFriends(notEmptyHosts).subscribe( 94 this.friendService.makeFriends(notEmptyHosts).subscribe(
91 status => { 95 status => {
92 this.notificationsService.success('Sucess', 'Make friends request sent!'); 96 this.notificationsService.success('Sucess', 'Make friends request sent!');
93 this.router.navigate([ '/admin/friends/list' ]); 97 this.router.navigate([ '/admin/friends/list' ]);
94 }, 98 },
95 99
96 err => this.notificationsService.error('Error', err.text) 100 err => this.notificationsService.error('Error', err.text)
101 );
102 }
97 ); 103 );
98 } 104 }
99 105