{"size": 914, "ext": "js", "max_stars_repo_path": "client/javascript/reducers/assessmentStatus.js", "max_stars_repo_name": "noms-digital-studio/csra-app", "max_stars_repo_stars_event_min_datetime": "2018-10-17T20:38:07.000Z", "max_stars_repo_stars_event_max_datetime": "2020-08-08T14:25:30.000Z", "max_issues_repo_path": "client/javascript/reducers/assessmentStatus.js", "max_issues_repo_name": "noms-digital-studio/csra-app", "max_issues_repo_issues_event_min_datetime": "2017-05-15T09:59:10.000Z", "max_issues_repo_issues_event_max_datetime": "2017-08-30T09:58:02.000Z", "max_forks_repo_path": "client/javascript/reducers/assessmentStatus.js", "max_forks_repo_name": "noms-digital-studio/csra-app", "max_forks_repo_forks_event_min_datetime": "2017-06-05T21:28:13.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T16:57:36.000Z"}
{"max_stars_count": 2, "max_issues_count": 6, "max_forks_count": 2, "avg_line_length": 20.7727272727, "max_line_length": 61, "alphanum_fraction": 0.5634573304}
import {
  HEALTHCARE_ANSWERS_COMPLETE,
  RISK_ANSWERS_COMPLETE,
} from '../constants/actions';

import { addUniqElementToList } from '../utils';

const defaultState = {
  awaitingSubmission: {
    risk: [],
    healthcare: [],
  },
};

export default (state = defaultState, { type, payload }) => {
  switch (type) {
    case HEALTHCARE_ANSWERS_COMPLETE:
      return {
        ...state,
        awaitingSubmission: {
          ...state.awaitingSubmission,
          healthcare: addUniqElementToList(
            payload,
            state.awaitingSubmission.healthcare,
          ),
        },
      };
    case RISK_ANSWERS_COMPLETE:
      return {
        ...state,
        awaitingSubmission: {
          ...state.awaitingSubmission,
          risk: addUniqElementToList(
            payload,
            state.awaitingSubmission.risk,
          ),
        },
      };

    default:
      return state;
  }
};
