diff options
Diffstat (limited to 'client/src/app/+admin/users/user-list/user-list.component.ts')
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 16 |
1 files changed, 12 insertions, 4 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 03f4e5c0a..ca08ed305 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 | |||
@@ -1,5 +1,7 @@ | |||
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications'; | ||
4 | |||
3 | import { User } from '../../../shared'; | 5 | import { User } from '../../../shared'; |
4 | import { UserService } from '../shared'; | 6 | import { UserService } from '../shared'; |
5 | 7 | ||
@@ -12,7 +14,10 @@ export class UserListComponent implements OnInit { | |||
12 | totalUsers: number; | 14 | totalUsers: number; |
13 | users: User[]; | 15 | users: User[]; |
14 | 16 | ||
15 | constructor(private userService: UserService) {} | 17 | constructor( |
18 | private notificationsService: NotificationsService, | ||
19 | private userService: UserService | ||
20 | ) {} | ||
16 | 21 | ||
17 | ngOnInit() { | 22 | ngOnInit() { |
18 | this.getUsers(); | 23 | this.getUsers(); |
@@ -25,7 +30,7 @@ export class UserListComponent implements OnInit { | |||
25 | this.totalUsers = totalUsers; | 30 | this.totalUsers = totalUsers; |
26 | }, | 31 | }, |
27 | 32 | ||
28 | err => alert(err.text) | 33 | err => this.notificationsService.error('Error', err.text) |
29 | ); | 34 | ); |
30 | } | 35 | } |
31 | 36 | ||
@@ -33,9 +38,12 @@ export class UserListComponent implements OnInit { | |||
33 | removeUser(user: User) { | 38 | removeUser(user: User) { |
34 | if (confirm('Are you sure?')) { | 39 | if (confirm('Are you sure?')) { |
35 | this.userService.removeUser(user).subscribe( | 40 | this.userService.removeUser(user).subscribe( |
36 | () => this.getUsers(), | 41 | () => { |
42 | this.notificationsService.success('Success', `User ${user.username} deleted.`); | ||
43 | this.getUsers(); | ||
44 | }, | ||
37 | 45 | ||
38 | err => alert(err.text) | 46 | err => this.notificationsService.error('Error', err.text) |
39 | ); | 47 | ); |
40 | } | 48 | } |
41 | } | 49 | } |