Created
April 30, 2019 18:17
-
-
Save artalar/900ce0e1db7e30f60f8ce0f166f09196 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
| export const validation = store => next => action => { | |
| switch(action.type){ | |
| case loginFormSubmit.type: { | |
| const isValid = validate(action.payload); | |
| if (isValid) return next(action) | |
| // else | |
| store.dispatch(loginFormIvalid()) | |
| } | |
| default: return next(action) | |
| } | |
| }; | |
| // ... | |
| applyMiddleware(thunk, validation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment