import { SET_SIDEBAR, SET_TOOL } from '../../constants/actionTypes';

const applyMiddleware = (dispatch: DispatchType) => (
  action: DispatchObjType,
): void => {
  dispatch(action);

  switch (action.type) {
    case SET_SIDEBAR: {
      dispatch({ type: SET_TOOL, payload: '' });
      break;
    }
    default:
      break;
  }
};

export default applyMiddleware;
