{"size": 452, "ext": "js", "max_stars_repo_path": "client/src/reducers/ticketReducer.js", "max_stars_repo_name": "ValentinPopa/bookster", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/src/reducers/ticketReducer.js", "max_issues_repo_name": "ValentinPopa/bookster", "max_issues_repo_issues_event_min_datetime": "2021-03-10T16:08:18.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T03:40:39.000Z", "max_forks_repo_path": "client/src/reducers/ticketReducer.js", "max_forks_repo_name": "ValentinPopa/bookster", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 7, "max_forks_count": null, "avg_line_length": 20.5454545455, "max_line_length": 78, "alphanum_fraction": 0.6349557522}
import { ADD_EVENT, REMOVE_EVENT, REMOVE_ALL_EVENTS } from '../actions/types';

const initialState = [];

export default (state = initialState, action) => {
  const { type, payload } = action;

  switch (type) {
    case ADD_EVENT:
      return [...state, payload];

    case REMOVE_EVENT:
      return state.filter(({ eventId }) => eventId !== payload);

    case REMOVE_ALL_EVENTS:
      return initialState;

    default:
      return state;
  }
};
