Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { REQUEST_EVENTS,
- RECEIVE_EVENTS, UPDATE_SORT_STATE } from '../actions/eventActions';
- import initialState from './initialState';
- const events = (state = {
- isFetchingEvents: false,
- ascending: true,
- events: []
- }, action) => {
- switch(action.type) {
- case REQUEST_EVENTS:
- return {
- ...state,
- isFetchingEvents: true
- };
- case RECEIVE_EVENTS:
- return {
- ...state,
- isFetchingEvents: false,
- events: action.events,
- sessions: action.sessions
- };
- case UPDATE_SORT_STATE :
- return {
- ...state,
- ascending: action.ascending
- };
- default:
- return state;
- }
- };
- export default events;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement