Created
October 1, 2018 22:12
-
-
Save basekays/1e5c2ae1714b8e034bc8186bdaba6acb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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