{"size": 631, "ext": "js", "max_stars_repo_path": "src/routes/CreatePlace/modules/createPlace.js", "max_stars_repo_name": "FrederickWWW/PhotoCity", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/routes/CreatePlace/modules/createPlace.js", "max_issues_repo_name": "FrederickWWW/PhotoCity", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/routes/CreatePlace/modules/createPlace.js", "max_forks_repo_name": "FrederickWWW/PhotoCity", "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": 13.7173913043, "max_line_length": 67, "alphanum_fraction": 0.6545166403}
/**
 * Created by Frederick on 2017/4/2.
 */

const ADD_PLACE = 'ADD_PLACE'


// Actions

let availableId = 0
export const addPlace = (value) => ({
  type: ADD_PLACE,
  payload:{
    title:value,
    id:availableId++
  }

})

export const actions = {
  addPlace
}

//Action Handlers

const ACTION_HANDLERS = {
  [ADD_PLACE]:(state,action) => {

    return ({...state, places:state.places.concat(action.payload)})
  }
}



// Reducers
const initialState = {
  places: []
}


export default function (state = initialState, action) {

  const handler = ACTION_HANDLERS[action.type]
  return handler ? handler(state, action) : state
}
