From e8ff4c8e56650bf061c63a7da3d84b742e618b6a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 30 Oct 2016 15:06:43 +0100 Subject: Refactoring redux state into different reducers --- app/assets/javascripts/components/reducers/user_lists.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'app/assets/javascripts/components/reducers/user_lists.jsx') diff --git a/app/assets/javascripts/components/reducers/user_lists.jsx b/app/assets/javascripts/components/reducers/user_lists.jsx index ee4b84296..d3b073e95 100644 --- a/app/assets/javascripts/components/reducers/user_lists.jsx +++ b/app/assets/javascripts/components/reducers/user_lists.jsx @@ -1,12 +1,14 @@ import { FOLLOWERS_FETCH_SUCCESS, FOLLOWING_FETCH_SUCCESS -} from '../actions/accounts'; -import Immutable from 'immutable'; +} from '../actions/accounts'; +import { SUGGESTIONS_FETCH_SUCCESS } from '../actions/suggestions'; +import Immutable from 'immutable'; const initialState = Immutable.Map({ followers: Immutable.Map(), - following: Immutable.Map() + following: Immutable.Map(), + suggestions: Immutable.List() }); export default function userLists(state = initialState, action) { @@ -15,6 +17,8 @@ export default function userLists(state = initialState, action) { return state.setIn(['followers', action.id], Immutable.List(action.accounts.map(item => item.id))); case FOLLOWING_FETCH_SUCCESS: return state.setIn(['following', action.id], Immutable.List(action.accounts.map(item => item.id))); + case SUGGESTIONS_FETCH_SUCCESS: + return state.set('suggestions', Immutable.List(action.accounts.map(item => item.id))); default: return state; } -- cgit