aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/friends
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-27 16:14:11 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-27 16:14:11 +0100
commit7ddd02c9b8c1e088f6679a2227f105e6439fc992 (patch)
treea1ff7af17f2a95abe85a2380834957e44032e8c2 /client/src/app/+admin/friends
parentcddadde81f91219204cec1f4057a191c02a70894 (diff)
downloadPeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.gz
PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.zst
PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.zip
Client: better notifications for a beautiful world
Diffstat (limited to 'client/src/app/+admin/friends')
-rw-r--r--client/src/app/+admin/friends/friend-add/friend-add.component.ts13
-rw-r--r--client/src/app/+admin/friends/friend-list/friend-list.component.ts15
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';
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
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 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
2 2
3import { NotificationsService } from 'angular2-notifications';
4
3import { Friend, FriendService } from '../shared'; 5import { Friend, FriendService } from '../shared';
4 6
5@Component({ 7@Component({
@@ -10,7 +12,10 @@ import { Friend, FriendService } from '../shared';
10export class FriendListComponent implements OnInit { 12export 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}