{"size": 901, "ext": "js", "max_stars_repo_path": "src/frontend/app/state/reducer/cards/byOwner.js", "max_stars_repo_name": "sz-piotr/eth-card-game", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/frontend/app/state/reducer/cards/byOwner.js", "max_issues_repo_name": "sz-piotr/eth-card-game", "max_issues_repo_issues_event_min_datetime": "2018-12-31T14:54:15.000Z", "max_issues_repo_issues_event_max_datetime": "2018-12-31T14:54:16.000Z", "max_forks_repo_path": "src/frontend/app/state/reducer/cards/byOwner.js", "max_forks_repo_name": "sz-piotr/eth-card-game", "max_forks_repo_forks_event_min_datetime": "2021-11-10T10:09:02.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-10T10:09:02.000Z"}
{"max_stars_count": null, "max_issues_count": 10, "max_forks_count": 1, "avg_line_length": 22.525, "max_line_length": 67, "alphanum_fraction": 0.551609323}
import {
  COLLECTION_FETCH_REQUESTED,
  COLLECTION_FETCH_SUCCEDED,
  COLLECTION_FETCH_FAILED
} from '../../actions'

export function reducer (state = {}, action) {
  switch (action.type) {
    case COLLECTION_FETCH_REQUESTED:
      return {
        ...state,
        [action.account]: {
          isFetching: true,
          error: false,
          data: state[action.account] && state[action.account].data
        }
      }
    case COLLECTION_FETCH_SUCCEDED:
      return {
        ...state,
        [action.account]: {
          isFetching: false,
          error: false,
          data: action.data
        }
      }
    case COLLECTION_FETCH_FAILED:
      return {
        ...state,
        [action.account]: {
          isFetching: false,
          error: action.error,
          data: state[action.account] && state[action.account].data
        }
      }
    default:
      return state
  }
}
