diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-19 23:25:59 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-19 23:26:21 +0200 |
commit | 337462aa5e68014aa15788e4513e190b2e434d7e (patch) | |
tree | a760e80e2bc9b1fef55f118ddeb8603b20155a61 /app/assets/javascripts/components/reducers/follow.jsx | |
parent | f820edb463109e313e836d8e2f210927a0eba7d1 (diff) |
Re-organizing components to be more modular, adding loading bars
Diffstat (limited to 'app/assets/javascripts/components/reducers/follow.jsx')
-rw-r--r-- | app/assets/javascripts/components/reducers/follow.jsx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/app/assets/javascripts/components/reducers/follow.jsx b/app/assets/javascripts/components/reducers/follow.jsx index 838f12259..e1dc293c6 100644 --- a/app/assets/javascripts/components/reducers/follow.jsx +++ b/app/assets/javascripts/components/reducers/follow.jsx @@ -1,22 +1,27 @@ -import * as constants from '../actions/follow'; -import Immutable from 'immutable'; +import { + FOLLOW_CHANGE, + FOLLOW_SUBMIT_REQUEST, + FOLLOW_SUBMIT_SUCCESS, + FOLLOW_SUBMIT_FAIL +} from '../actions/follow'; +import Immutable from 'immutable'; const initialState = Immutable.Map({ text: '', is_submitting: false }); -export default function compose(state = initialState, action) { +export default function follow(state = initialState, action) { switch(action.type) { - case constants.FOLLOW_CHANGE: + case FOLLOW_CHANGE: return state.set('text', action.text); - case constants.FOLLOW_SUBMIT_REQUEST: + case FOLLOW_SUBMIT_REQUEST: return state.set('is_submitting', true); - case constants.FOLLOW_SUBMIT_SUCCESS: + case FOLLOW_SUBMIT_SUCCESS: return state.withMutations(map => { map.set('text', '').set('is_submitting', false); }); - case constants.FOLLOW_SUBMIT_FAIL: + case FOLLOW_SUBMIT_FAIL: return state.set('is_submitting', false); default: return state; |