{"size": 1194, "ext": "js", "max_stars_repo_path": "app/reducers/index.js", "max_stars_repo_name": "TopWebGhost/prodigy-test", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/reducers/index.js", "max_issues_repo_name": "TopWebGhost/prodigy-test", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/reducers/index.js", "max_forks_repo_name": "TopWebGhost/prodigy-test", "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": 19.9, "max_line_length": 52, "alphanum_fraction": 0.5795644891}
import { combineReducers } from 'redux';
import * as types from '../actions/types';

const initialState = {
  properties: [],
  currentProperty: {},
  fetching: false,
  fetched: false,
  error: null
};

const property = (state = initialState, action) => {
  switch (action.type) {
    case types.FETCH_PROPERTIES_START:
      return {
        ...state,
        fetching: true
      };
    case types.FETCH_PROPERTIES_SUCCESS:
      return {
        ...state,
        fetching: false,
        fetched: true,
        properties: action.payload
      };
    case types.FETCH_PROPERTIES_ERROR:
      return {
        ...state,
        fetching: false,
        error: action.payload
      };
    case types.FETCH_PROPERTY_START:
      return {
        ...state,
        fetching: true
      };
    case types.FETCH_PROPERTY_SUCCESS:
      return {
        ...state,
        fetching: false,
        currentProperty: action.payload
      };
    case types.FETCH_PROPERTY_ERROR:
      return {
        ...state,
        fetching: false,
        error: action.payload
      };
    default:
      return state;
  }
};


const rootReducer = combineReducers({
  property
});

export default rootReducer;
