feat(follow): follow & unfollow in userinfo page

This commit is contained in:
OldHawk
2018-01-04 12:14:43 +08:00
parent 7c95d3a547
commit 95422aaaec
10 changed files with 157 additions and 9 deletions

View File

@@ -76,6 +76,13 @@
vm.getCountUnread();
});
/**
* user-follow-changed
*/
$scope.$on('user-follow-changed', function (event, u) {
vm.user = Authentication.user = u;
});
/**
* getInvitationsCount
*/
@@ -97,9 +104,9 @@
*/
vm.getFollowCount = function (item) {
if (item.state.indexOf('followers') >= 0) {
return vm.user.followers.length;
return vm.user ? vm.user.followers.length : 0;
} else {
return vm.user.following.length;
return vm.user ? vm.user.following.length : 0;
}
};