import { delegatesAdded } from '../../actions/voting';
import actionTypes from '../../constants/actions';

const votingMiddleware =
(store, next) => (action) => {
  if (action.type === actionTypes.DELEGATES_ADDED) {
    delegatesAdded(store, action.payload);
  }
  return next(action);
};

export default votingMiddleware;