1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1x 5x 5x 7x 7x 1x 6x 2x | import { showLoading, hideLoading } from './loading_bar_ducks' export default function loadingBarMiddleware({ dispatch }) { return next => action => { next(action) if (action.type.includes('_PENDING')) { dispatch(showLoading()) } else if (action.type.includes('_FULFILLED') || action.type.includes('_REJECTED')) { dispatch(hideLoading()) } } } |