Client: refresh friends list after quitting them
This commit is contained in:
parent
039cdfc528
commit
93c462b771
1 changed files with 10 additions and 5 deletions
|
@ -15,11 +15,7 @@ export class FriendListComponent implements OnInit {
|
||||||
constructor(private friendService: FriendService) { }
|
constructor(private friendService: FriendService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.friendService.getFriends().subscribe(
|
this.getFriends();
|
||||||
friends => this.friends = friends,
|
|
||||||
|
|
||||||
err => alert(err)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quitFriends() {
|
quitFriends() {
|
||||||
|
@ -28,8 +24,17 @@ export class FriendListComponent implements OnInit {
|
||||||
this.friendService.quitFriends().subscribe(
|
this.friendService.quitFriends().subscribe(
|
||||||
status => {
|
status => {
|
||||||
alert('Quit friends!');
|
alert('Quit friends!');
|
||||||
|
this.getFriends();
|
||||||
},
|
},
|
||||||
error => alert(error)
|
error => alert(error)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getFriends() {
|
||||||
|
this.friendService.getFriends().subscribe(
|
||||||
|
friends => this.friends = friends,
|
||||||
|
|
||||||
|
err => alert(err)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue