From da08388d6af314fb298bae011da31bcfc8ac0a45 Mon Sep 17 00:00:00 2001 From: shpuld Date: Mon, 29 Apr 2019 22:36:39 +0300 Subject: filter outside of component --- src/modules/statuses.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/modules/statuses.js') diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 527cafc2..1a223d09 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -533,8 +533,19 @@ const statuses = { }) }, fetchFavsAndRepeats ({ rootState, commit }, id) { - Promise.all([rootState.api.backendInteractor.fetchFavoritedByUsers(id), rootState.api.backendInteractor.fetchRebloggedByUsers(id)]) - .then(([favoritedByUsers, rebloggedByUsers]) => commit('addFavsAndRepeats', { id, favoritedByUsers, rebloggedByUsers })) + Promise.all([ + rootState.api.backendInteractor.fetchFavoritedByUsers(id), + rootState.api.backendInteractor.fetchRebloggedByUsers(id) + ]).then(([favoritedByUsers, rebloggedByUsers]) => + commit( + 'addFavsAndRepeats', + { + id, + favoritedByUsers: favoritedByUsers.filter(_ => _), + rebloggedByUsers: rebloggedByUsers.filter(_ => _) + } + ) + ) } }, mutations -- cgit v1.2.3-70-g09d2