aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/friends/friend-add/friend-add.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/friends/friend-add/friend-add.component.ts')
-rw-r--r--client/src/app/+admin/friends/friend-add/friend-add.component.ts13
1 files changed, 10 insertions, 3 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';
2import { FormControl, FormGroup } from '@angular/forms'; 2import { FormControl, FormGroup } from '@angular/forms';
3import { Router } from '@angular/router'; 3import { Router } from '@angular/router';
4 4
5import { NotificationsService } from 'angular2-notifications';
6
5import { validateHost } from '../../../shared'; 7import { validateHost } from '../../../shared';
6import { FriendService } from '../shared'; 8import { 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