diff options
Diffstat (limited to 'client/src/app/+admin/friends')
-rw-r--r-- | client/src/app/+admin/friends/friend-add/friend-add.component.ts | 13 | ||||
-rw-r--r-- | client/src/app/+admin/friends/friend-list/friend-list.component.ts | 15 |
2 files changed, 21 insertions, 7 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 014252011..a271970ae 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 | |||
@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; | |||
2 | import { FormControl, FormGroup } from '@angular/forms'; | 2 | import { FormControl, FormGroup } from '@angular/forms'; |
3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
4 | 4 | ||
5 | import { NotificationsService } from 'angular2-notifications'; | ||
6 | |||
5 | import { validateHost } from '../../../shared'; | 7 | import { validateHost } from '../../../shared'; |
6 | import { FriendService } from '../shared'; | 8 | import { FriendService } from '../shared'; |
7 | 9 | ||
@@ -15,7 +17,11 @@ export class FriendAddComponent implements OnInit { | |||
15 | hosts = [ ]; | 17 | hosts = [ ]; |
16 | error: string = null; | 18 | error: string = null; |
17 | 19 | ||
18 | constructor(private router: Router, private friendService: FriendService) {} | 20 | constructor( |
21 | private router: Router, | ||
22 | private notificationsService: NotificationsService, | ||
23 | private friendService: FriendService | ||
24 | ) {} | ||
19 | 25 | ||
20 | ngOnInit() { | 26 | ngOnInit() { |
21 | this.form = new FormGroup({}); | 27 | this.form = new FormGroup({}); |
@@ -83,10 +89,11 @@ export class FriendAddComponent implements OnInit { | |||
83 | 89 | ||
84 | this.friendService.makeFriends(notEmptyHosts).subscribe( | 90 | this.friendService.makeFriends(notEmptyHosts).subscribe( |
85 | status => { | 91 | status => { |
86 | alert('Make friends request sent!'); | 92 | this.notificationsService.success('Sucess', 'Make friends request sent!'); |
87 | this.router.navigate([ '/admin/friends/list' ]); | 93 | this.router.navigate([ '/admin/friends/list' ]); |
88 | }, | 94 | }, |
89 | error => alert(error.text) | 95 | |
96 | err => this.notificationsService.error('Error', err.text) | ||
90 | ); | 97 | ); |
91 | } | 98 | } |
92 | 99 | ||
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 bec10162c..700ea7a69 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 | |||
@@ -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 { Friend, FriendService } from '../shared'; | 5 | import { Friend, FriendService } from '../shared'; |
4 | 6 | ||
5 | @Component({ | 7 | @Component({ |
@@ -10,7 +12,10 @@ import { Friend, FriendService } from '../shared'; | |||
10 | export class FriendListComponent implements OnInit { | 12 | export class FriendListComponent implements OnInit { |
11 | friends: Friend[]; | 13 | friends: Friend[]; |
12 | 14 | ||
13 | constructor(private friendService: FriendService) { } | 15 | constructor( |
16 | private notificationsService: NotificationsService, | ||
17 | private friendService: FriendService | ||
18 | ) { } | ||
14 | 19 | ||
15 | ngOnInit() { | 20 | ngOnInit() { |
16 | this.getFriends(); | 21 | this.getFriends(); |
@@ -21,10 +26,12 @@ export class FriendListComponent implements OnInit { | |||
21 | 26 | ||
22 | this.friendService.quitFriends().subscribe( | 27 | this.friendService.quitFriends().subscribe( |
23 | status => { | 28 | status => { |
24 | alert('Quit friends!'); | 29 | this.notificationsService.success('Sucess', 'Friends left!'); |
30 | |||
25 | this.getFriends(); | 31 | this.getFriends(); |
26 | }, | 32 | }, |
27 | error => alert(error.text) | 33 | |
34 | err => this.notificationsService.error('Error', err.text) | ||
28 | ); | 35 | ); |
29 | } | 36 | } |
30 | 37 | ||
@@ -32,7 +39,7 @@ export class FriendListComponent implements OnInit { | |||
32 | this.friendService.getFriends().subscribe( | 39 | this.friendService.getFriends().subscribe( |
33 | res => this.friends = res.friends, | 40 | res => this.friends = res.friends, |
34 | 41 | ||
35 | err => alert(err.text) | 42 | err => this.notificationsService.error('Error', err.text) |
36 | ); | 43 | ); |
37 | } | 44 | } |
38 | } | 45 | } |