This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2016-09-01 15:13:02 +02:00
|
|
|
import * as constants from '../actions/follow';
|
|
|
|
import Immutable from 'immutable';
|
|
|
|
|
|
|
|
const initialState = Immutable.Map({
|
|
|
|
text: '',
|
|
|
|
is_submitting: false
|
|
|
|
});
|
|
|
|
|
|
|
|
export default function compose(state = initialState, action) {
|
|
|
|
switch(action.type) {
|
|
|
|
case constants.FOLLOW_CHANGE:
|
|
|
|
return state.set('text', action.text);
|
|
|
|
case constants.FOLLOW_SUBMIT_REQUEST:
|
|
|
|
return state.set('is_submitting', true);
|
|
|
|
case constants.FOLLOW_SUBMIT_SUCCESS:
|
|
|
|
return state.withMutations(map => {
|
|
|
|
map.set('text', '').set('is_submitting', false);
|
|
|
|
});
|
|
|
|
case constants.FOLLOW_SUBMIT_FAIL:
|
|
|
|
return state.set('is_submitting', false);
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
2016-09-12 19:20:55 +02:00
|
|
|
};
|