Rewrite FollowList using hocs

This commit is contained in:
taehoon 2019-02-25 04:51:23 -05:00
parent cb383df517
commit 080786c945
6 changed files with 45 additions and 116 deletions

View file

@ -72,14 +72,20 @@ export const mutations = {
},
// Because frontend doesn't have a reason to keep these stuff in memory
// outside of viewing someones user profile.
clearFriendsAndFollowers (state, userKey) {
const user = state.usersObject[userKey]
clearFriends (state, userId) {
const user = state.usersObject[userId]
if (!user) {
return
}
user.friends = []
user.followers = []
user.friendsPage = 0
},
clearFollowers (state, userId) {
const user = state.usersObject[userId]
if (!user) {
return
}
user.followers = []
user.followersPage = 0
},
addNewUsers (state, users) {
@ -197,8 +203,11 @@ const users = {
return followers
})
},
clearFriendsAndFollowers ({ commit }, userKey) {
commit('clearFriendsAndFollowers', userKey)
clearFriends ({ commit }, userId) {
commit('clearFriends', userId)
},
clearFollowers ({ commit }, userId) {
commit('clearFollowers', userId)
},
registerPushNotifications (store) {
const token = store.state.currentUser.credentials