Skip to content

Instantly share code, notes, and snippets.

@DanCassiano
Last active April 29, 2017 23:26
Show Gist options
  • Save DanCassiano/d1aaef6d7d5cdf8015a89c678c245520 to your computer and use it in GitHub Desktop.
Save DanCassiano/d1aaef6d7d5cdf8015a89c678c245520 to your computer and use it in GitHub Desktop.
import * as types from './types';
export const initialState = {
msg: ''
};
export default (state = initialState, action) => {
switch (action.type) {
case types.TRY_SUBMIT:
return trySubmit(state);
case types.SUBMIT_SUCCESS:
return submitSuccess(state, action);
case types.SUBMIT_FAILURE:
return submitFailure(state, action);
default:
return state;
}
};
function trySubmit(state) {
return {...state, msg: '' };
}
function submitSuccess(state, action) {
return {...state, msg: action.msg };
}
function submitFailure(state, action) {
return {...state, msg: action.msg };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment