{"size": 1342, "ext": "js", "max_stars_repo_path": "Client/src/reducers/exercisesReducer.js", "max_stars_repo_name": "Karol-Waliszewski/Workout-Challenger", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Client/src/reducers/exercisesReducer.js", "max_issues_repo_name": "Karol-Waliszewski/Workout-Challenger", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Client/src/reducers/exercisesReducer.js", "max_forks_repo_name": "Karol-Waliszewski/Workout-Challenger", "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": 20.3333333333, "max_line_length": 56, "alphanum_fraction": 0.523099851}
export default function authReducer(state = {
  pending: false,
  fetched: false,
  exerciseFilter: null
}, action) {
  switch (action.type) {
    case 'EXERCISE_PENDING':
      return {
        ...state,
        pending: true,
        fetched: false
      }
      break;
    case 'EXERCISES_SUCCESS':
      return {
        ...state,
        pending: false,
        fetched: true,
        exercises: action.payload
      }
      break;
    case 'EXERCISE_SUCCESS':
      return {
        ...state,
        pending: false,
        fetched: true,
        exercise: action.payload
      }
      break;
    case 'EXERCISE_UPDATE':
    let newValue = {};
    newValue[action.payload.prop] = action.payload.value
      return {
        ...state,
        fetched: false,
        exercise: {...state.exercise,...newValue}
      }
      break
    case 'EXERCISE_FILTER':
      return {
        ...state,
        pending: false,
        fetched: true,
        exerciseFilter: action.payload
      }
      break;
    case 'EXERCISE_ERROR':
      return {
        ...state,
        pending: false,
        fetched: false,
        error: action.payload
      }
      break;
    case 'EXERCISE_RESET':
      return {
        pending: false,
        fetched: false,
        exerciseFilter: null
      }
      break;
    default:
      return state;
  }
};
