Last active
April 29, 2017 23:26
-
-
Save DanCassiano/d1aaef6d7d5cdf8015a89c678c245520 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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