{"size": 1106, "ext": "js", "max_stars_repo_path": "frontend/admin/app/components/shared/OpenJob/reducer.js", "max_stars_repo_name": "longtkhd/Pepople_profiler", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "frontend/admin/app/components/shared/OpenJob/reducer.js", "max_issues_repo_name": "longtkhd/Pepople_profiler", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "frontend/admin/app/components/shared/OpenJob/reducer.js", "max_forks_repo_name": "longtkhd/Pepople_profiler", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.1363636364, "max_line_length": 56, "alphanum_fraction": 0.6826401447}
/*
 *
 * OpenJob reducer
 *
 */
import produce from 'immer';
import { 
  ASSIGN_RECRUITER,
  ASSIGN_RECRUITER_SUCCESS,
  ASSIGN_RECRUITER_ERROR,
} from './constants';

export const initialState = {
  assignRecruiterLoading: false,
  assignRecruiterError: null,
  assignRecruiterResponse: null,
};

/* eslint-disable default-case, no-param-reassign */
const openJobReducer = (state = initialState, action) =>
  produce(state, draft => {
    switch (action.type) {
      case ASSIGN_RECRUITER:
        draft.assignRecruiterLoading = true;
        draft.assignRecruiterError = null;
        draft.assignRecruiterResponse = null;
        break;
      case ASSIGN_RECRUITER_SUCCESS:
        draft.assignRecruiterError = null;
        draft.assignRecruiterLoading = false;
        draft.assignRecruiterResponse = action.response;
        break;
      case ASSIGN_RECRUITER_ERROR:
        draft.assignRecruiterError = action.error;
        draft.assignRecruiterLoading = false;
        draft.assignRecruiterResponse = null;
        break;
      default:
        break;
    }
  });

export default openJobReducer;
