Skip to content

Instantly share code, notes, and snippets.

@basekays
Created October 1, 2018 22:12
Show Gist options
  • Save basekays/1e5c2ae1714b8e034bc8186bdaba6acb to your computer and use it in GitHub Desktop.
Save basekays/1e5c2ae1714b8e034bc8186bdaba6acb to your computer and use it in GitHub Desktop.
import {
GET_PLACES,
GET_PLACES_SUCCESS,
GET_PLACES_FAILURE
} from '../../actions/getPlaces';
const INITIAL_STATE = {
places: [],
errors: [],
}
export default function(state = INITIAL_STATE, action = {}) {
const { type, places, errors } = action;
switch (type) {
case GET_PLACES:
return {
...state,
};
case GET_PLACES_FAILURE:
return {
...state,
errors,
};
case GET_PLACES_SUCCESS:
return {
...state,
places,
};
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment