Created
July 30, 2021 02:23
-
-
Save MeetMartin/14e14c2acca5d30e2123ef1fa851b9aa 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
// /src/store/middleware.js | |
import types from './types'; | |
import { getQuote } from './hooks/QuoteHook'; | |
const applyMiddleware = state => dispatch => action => { | |
switch (action.type) { | |
case types.REQUEST_RANDOM_QUOTE: | |
console.debug('[applyMiddleware]', types.REQUEST_RANDOM_QUOTE); | |
getQuote(dispatch)(action); | |
break; | |
}; | |
dispatch(action); | |
}; | |
export { applyMiddleware }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment