Re-organizing components to be more modular, adding loading bars

This commit is contained in:
Eugen Rochko
2016-09-19 23:25:59 +02:00
parent f820edb463
commit 337462aa5e
31 changed files with 155 additions and 126 deletions

View File

@@ -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;