diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 16:54:44 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 16:59:56 +0100 |
commit | 5769e1db8d3d5a1e3baa8dff23090cfe93d48a50 (patch) | |
tree | acbb14fda82b7517734f22d4ca57fb5e1ff9ef04 /client/src/app/+admin/users | |
parent | 7ddd02c9b8c1e088f6679a2227f105e6439fc992 (diff) | |
download | PeerTube-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/users')
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 26 |
1 files changed, 16 insertions, 10 deletions
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'; | |||
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications'; | 3 | import { NotificationsService } from 'angular2-notifications'; |
4 | 4 | ||
5 | import { ConfirmService } from '../../../core'; | ||
5 | import { User } from '../../../shared'; | 6 | import { User } from '../../../shared'; |
6 | import { UserService } from '../shared'; | 7 | import { UserService } from '../shared'; |
7 | 8 | ||
@@ -16,6 +17,7 @@ export class UserListComponent implements OnInit { | |||
16 | 17 | ||
17 | constructor( | 18 | constructor( |
18 | private notificationsService: NotificationsService, | 19 | private notificationsService: NotificationsService, |
20 | private confirmService: ConfirmService, | ||
19 | private userService: UserService | 21 | private userService: UserService |
20 | ) {} | 22 | ) {} |
21 | 23 | ||
@@ -36,15 +38,19 @@ export class UserListComponent implements OnInit { | |||
36 | 38 | ||
37 | 39 | ||
38 | removeUser(user: User) { | 40 | removeUser(user: User) { |
39 | if (confirm('Are you sure?')) { | 41 | this.confirmService.confirm('Do you really want to delete this user?', 'Delete').subscribe( |
40 | this.userService.removeUser(user).subscribe( | 42 | res => { |
41 | () => { | 43 | if (res === false) return; |
42 | this.notificationsService.success('Success', `User ${user.username} deleted.`); | 44 | |
43 | this.getUsers(); | 45 | this.userService.removeUser(user).subscribe( |
44 | }, | 46 | () => { |
45 | 47 | this.notificationsService.success('Success', `User ${user.username} deleted.`); | |
46 | err => this.notificationsService.error('Error', err.text) | 48 | this.getUsers(); |
47 | ); | 49 | }, |
48 | } | 50 | |
51 | err => this.notificationsService.error('Error', err.text) | ||
52 | ); | ||
53 | } | ||
54 | ); | ||
49 | } | 55 | } |
50 | } | 56 | } |