index.ts 419 B

1234567891011121314151617181920
  1. import { Dispatch } from 'react';
  2. import { SET_SIDEBAR, SET_TOOL } from '../../constants/actionTypes';
  3. const applyMiddleware = (dispatch: Dispatch<any>) => (action: {
  4. type: string;
  5. payload?: any;
  6. }): void => {
  7. dispatch(action);
  8. switch (action.type) {
  9. case SET_SIDEBAR: {
  10. dispatch({ type: SET_TOOL, payload: '' });
  11. break;
  12. }
  13. default:
  14. break;
  15. }
  16. };
  17. export default applyMiddleware;