{"size": 709, "ext": "js", "max_stars_repo_path": "src/reducers/planReducer/ministerIssuesReducer.js", "max_stars_repo_name": "bcgov/range-myra-web", "max_stars_repo_stars_event_min_datetime": "2018-02-18T00:42:21.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-10T11:31:57.000Z", "max_issues_repo_path": "src/reducers/planReducer/ministerIssuesReducer.js", "max_issues_repo_name": "bcgov/range-myra-web", "max_issues_repo_issues_event_min_datetime": "2019-03-13T17:12:50.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:41:06.000Z", "max_forks_repo_path": "src/reducers/planReducer/ministerIssuesReducer.js", "max_forks_repo_name": "bcgov/range-myra-web", "max_forks_repo_forks_event_min_datetime": "2018-03-05T19:30:10.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-23T07:05:52.000Z"}
{"max_stars_count": 6, "max_issues_count": 547, "max_forks_count": 10, "avg_line_length": 21.4848484848, "max_line_length": 80, "alphanum_fraction": 0.682651622}
import { STORE_PLAN, MINISTER_ISSUE_UPDATED } from '../../constants/actionTypes'

const storeMinisterIssues = (state, action) => {
  const { ministerIssues } = action.payload.entities

  return {
    ...state,
    ...ministerIssues
  }
}

const updateMinisterissue = (state, action) => {
  const { ministerIssue } = action.payload

  return {
    ...state,
    [ministerIssue.id]: ministerIssue
  }
}

const ministerIssuesReducer = (state = {}, action) => {
  switch (action.type) {
    case STORE_PLAN:
      return storeMinisterIssues(state, action)
    case MINISTER_ISSUE_UPDATED:
      return updateMinisterissue(state, action)
    default:
      return state
  }
}

export default ministerIssuesReducer
