You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
787 B

  1. import * as constants from '../actions/follow';
  2. import Immutable from 'immutable';
  3. const initialState = Immutable.Map({
  4. text: '',
  5. is_submitting: false
  6. });
  7. export default function compose(state = initialState, action) {
  8. switch(action.type) {
  9. case constants.FOLLOW_CHANGE:
  10. return state.set('text', action.text);
  11. case constants.FOLLOW_SUBMIT_REQUEST:
  12. return state.set('is_submitting', true);
  13. case constants.FOLLOW_SUBMIT_SUCCESS:
  14. return state.withMutations(map => {
  15. map.set('text', '').set('is_submitting', false);
  16. });
  17. case constants.FOLLOW_SUBMIT_FAIL:
  18. return state.set('is_submitting', false);
  19. default:
  20. return state;
  21. }
  22. }