Clean up addFollowers action

This commit is contained in:
taehoon 2019-02-25 02:11:39 -05:00
parent 3a689ef8ee
commit 5c43374588

View file

@ -189,17 +189,13 @@ const users = {
}) })
}, },
addFollowers ({ rootState, commit }, fetchBy) { addFollowers ({ rootState, commit }, fetchBy) {
return new Promise((resolve, reject) => { const user = rootState.users.usersObject[fetchBy]
const user = rootState.users.usersObject[fetchBy] const page = user.followersPage || 1
const page = user.followersPage || 1 return rootState.api.backendInteractor.fetchFollowers({ id: user.id, page })
rootState.api.backendInteractor.fetchFollowers({ id: user.id, page }) .then((followers) => {
.then((followers) => { commit('addFollowers', { id: user.id, followers, page })
commit('addFollowers', { id: user.id, followers, page }) return followers
resolve(followers) })
}).catch(() => {
reject()
})
})
}, },
clearFriendsAndFollowers ({ commit }, userKey) { clearFriendsAndFollowers ({ commit }, userKey) {
commit('clearFriendsAndFollowers', userKey) commit('clearFriendsAndFollowers', userKey)