Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Created July 30, 2021 02:23
Show Gist options
  • Save MeetMartin/14e14c2acca5d30e2123ef1fa851b9aa to your computer and use it in GitHub Desktop.
Save MeetMartin/14e14c2acca5d30e2123ef1fa851b9aa to your computer and use it in GitHub Desktop.
// /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