Last active
July 15, 2016 09:47
-
-
Save jacobp100/6fb6b93f3431fe0dbfe75c9534beb9fd 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 serialize from 'form-serialize'; | |
| import actionCreators from './actionCreators'; | |
| export const formDispatcher = dispatch => event => { | |
| event.preventDefault(); | |
| const actionParams = serialize(event.currentTarget, { hash: true, empty: true }); | |
| const actionCreator = actionCreators[actionParams['action-creator']]; | |
| const action = actionCreator(actionParams); | |
| dispatch(action); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment