]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/admin/friends/friend-list/friend-list.component.ts
Client: refresh friends list after quitting them
[github/Chocobozzz/PeerTube.git] / client / src / app / admin / friends / friend-list / friend-list.component.ts
index 379d44c975a5d83055577267cab1e214a9d1ec7c..38d4799a6ecf3babce1d9564386bb024296110c9 100644 (file)
@@ -15,11 +15,7 @@ export class FriendListComponent implements OnInit {
   constructor(private friendService: FriendService) {  }
 
   ngOnInit() {
-    this.friendService.getFriends().subscribe(
-      friends => this.friends = friends,
-
-      err => alert(err)
-    );
+    this.getFriends();
   }
 
   quitFriends() {
@@ -28,8 +24,17 @@ export class FriendListComponent implements OnInit {
     this.friendService.quitFriends().subscribe(
       status => {
         alert('Quit friends!');
+        this.getFriends();
       },
       error => alert(error)
     );
   }
+
+  private getFriends() {
+    this.friendService.getFriends().subscribe(
+      friends => this.friends = friends,
+
+      err => alert(err)
+    );
+  }
 }