Skip to content

Instantly share code, notes, and snippets.

@artalar
Created April 30, 2019 18:17
Show Gist options
  • Select an option

  • Save artalar/900ce0e1db7e30f60f8ce0f166f09196 to your computer and use it in GitHub Desktop.

Select an option

Save artalar/900ce0e1db7e30f60f8ce0f166f09196 to your computer and use it in GitHub Desktop.
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