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';
import { NotificationsService } from 'angular2-notifications';
+import { ConfirmService } from '../../../core';
import { validateHost } from '../../../shared';
import { FriendService } from '../shared';
@@ -20,6 +21,7 @@ export class FriendAddComponent implements OnInit {
constructor(
private router: Router,
private notificationsService: NotificationsService,
+ private confirmService: ConfirmService,
private friendService: FriendService
) {}
@@ -84,16 +86,20 @@ export class FriendAddComponent implements OnInit {
return;
}
- const confirmMessage = 'Are you sure to make friends with:\n - ' + notEmptyHosts.join('\n - ');
- if (!confirm(confirmMessage)) return;
+ const confirmMessage = 'Are you sure to make friends with:
- ' + notEmptyHosts.join('
- ');
+ this.confirmService.confirm(confirmMessage, 'Make friends').subscribe(
+ res => {
+ if (res === false) return;
- this.friendService.makeFriends(notEmptyHosts).subscribe(
- status => {
- this.notificationsService.success('Sucess', 'Make friends request sent!');
- this.router.navigate([ '/admin/friends/list' ]);
- },
+ this.friendService.makeFriends(notEmptyHosts).subscribe(
+ status => {
+ this.notificationsService.success('Sucess', 'Make friends request sent!');
+ this.router.navigate([ '/admin/friends/list' ]);
+ },
- err => this.notificationsService.error('Error', err.text)
+ err => this.notificationsService.error('Error', err.text)
+ );
+ }
);
}
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';
import { NotificationsService } from 'angular2-notifications';
+import { ConfirmService } from '../../../core';
import { Friend, FriendService } from '../shared';
@Component({
@@ -14,6 +15,7 @@ export class FriendListComponent implements OnInit {
constructor(
private notificationsService: NotificationsService,
+ private confirmService: ConfirmService,
private friendService: FriendService
) { }
@@ -22,16 +24,21 @@ export class FriendListComponent implements OnInit {
}
quitFriends() {
- if (!confirm('Are you sure?')) return;
+ const confirmMessage = 'Do you really want to quit your friends? All their videos will be deleted.';
+ this.confirmService.confirm(confirmMessage, 'Quit friends').subscribe(
+ res => {
+ if (res === false) return;
- this.friendService.quitFriends().subscribe(
- status => {
- this.notificationsService.success('Sucess', 'Friends left!');
+ this.friendService.quitFriends().subscribe(
+ status => {
+ this.notificationsService.success('Sucess', 'Friends left!');
- this.getFriends();
- },
+ this.getFriends();
+ },
- err => this.notificationsService.error('Error', err.text)
+ err => this.notificationsService.error('Error', err.text)
+ );
+ }
);
}
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts
index ca08ed305..baefb7064 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/users/user-list/user-list.component.ts
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { NotificationsService } from 'angular2-notifications';
+import { ConfirmService } from '../../../core';
import { User } from '../../../shared';
import { UserService } from '../shared';
@@ -16,6 +17,7 @@ export class UserListComponent implements OnInit {
constructor(
private notificationsService: NotificationsService,
+ private confirmService: ConfirmService,
private userService: UserService
) {}
@@ -36,15 +38,19 @@ export class UserListComponent implements OnInit {
removeUser(user: User) {
- if (confirm('Are you sure?')) {
- this.userService.removeUser(user).subscribe(
- () => {
- this.notificationsService.success('Success', `User ${user.username} deleted.`);
- this.getUsers();
- },
+ this.confirmService.confirm('Do you really want to delete this user?', 'Delete').subscribe(
+ res => {
+ if (res === false) return;
- err => this.notificationsService.error('Error', err.text)
- );
- }
+ this.userService.removeUser(user).subscribe(
+ () => {
+ this.notificationsService.success('Success', `User ${user.username} deleted.`);
+ this.getUsers();
+ },
+
+ err => this.notificationsService.error('Error', err.text)
+ );
+ }
+ );
}
}
diff --git a/client/src/app/app.component.html b/client/src/app/app.component.html
index 95a025832..9f2661e12 100644
--- a/client/src/app/app.component.html
+++ b/client/src/app/app.component.html
@@ -23,6 +23,7 @@
+