{"size": 721, "ext": "js", "max_stars_repo_path": "client/store/song.js", "max_stars_repo_name": "dancing-karaoke/Capstone", "max_stars_repo_stars_event_min_datetime": "2018-12-27T04:37:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-15T16:04:30.000Z", "max_issues_repo_path": "client/store/song.js", "max_issues_repo_name": "Zudva/Dance-Dance-Pose", "max_issues_repo_issues_event_min_datetime": "2018-11-19T22:03:39.000Z", "max_issues_repo_issues_event_max_datetime": "2018-11-24T07:01:16.000Z", "max_forks_repo_path": "client/store/song.js", "max_forks_repo_name": "Zudva/Dance-Dance-Pose", "max_forks_repo_forks_event_min_datetime": "2018-12-27T04:37:22.000Z", "max_forks_repo_forks_event_max_datetime": "2019-07-13T07:32:58.000Z"}
{"max_stars_count": 5, "max_issues_count": 2, "max_forks_count": 4, "avg_line_length": 14.42, "max_line_length": 64, "alphanum_fraction": 0.6061026352}
/**
 * ACTION TYPES
 */

const SELECT_SONG = 'SELECT_SONG'
const SELECT_LEVEL = 'SELECT_LEVEL'

/**
 * INITIAL STATE
 */
export const initialSongState = {
  selectedSong: '',
  level: ''
}

/**
 * ACTION CREATORS
 */

export const selectSong = selectedSong => ({
  type: SELECT_SONG,
  selectedSong
})

export const selectLevel = level => ({
  type: SELECT_LEVEL,
  level
})

/**
 * REDUCER
 */

export default function song(state = initialSongState, action) {
  switch (action.type) {
    case SELECT_SONG:
      return {
        ...state,
        selectedSong: action.selectedSong
      }
    case SELECT_LEVEL:
      return {
        ...state,
        level: action.level
      }
    default:
      return state
  }
}
