From 5c43374588b810bf1ba8b74414867d0324b3c59f Mon Sep 17 00:00:00 2001 From: taehoon Date: Mon, 25 Feb 2019 02:11:39 -0500 Subject: [PATCH] Clean up addFollowers action --- src/modules/users.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/modules/users.js b/src/modules/users.js index eabfe5ae..b2821a92 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -189,17 +189,13 @@ const users = { }) }, addFollowers ({ rootState, commit }, fetchBy) { - return new Promise((resolve, reject) => { - const user = rootState.users.usersObject[fetchBy] - const page = user.followersPage || 1 - rootState.api.backendInteractor.fetchFollowers({ id: user.id, page }) - .then((followers) => { - commit('addFollowers', { id: user.id, followers, page }) - resolve(followers) - }).catch(() => { - reject() - }) - }) + const user = rootState.users.usersObject[fetchBy] + const page = user.followersPage || 1 + return rootState.api.backendInteractor.fetchFollowers({ id: user.id, page }) + .then((followers) => { + commit('addFollowers', { id: user.id, followers, page }) + return followers + }) }, clearFriendsAndFollowers ({ commit }, userKey) { commit('clearFriendsAndFollowers', userKey)