Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import { REQUEST_EVENTS,
  2. RECEIVE_EVENTS, UPDATE_SORT_STATE } from '../actions/eventActions';
  3.  
  4. import initialState from './initialState';
  5.  
  6. const events = (state = {
  7. isFetchingEvents: false,
  8. ascending: true,
  9. events: []
  10. }, action) => {
  11. switch(action.type) {
  12. case REQUEST_EVENTS:
  13. return {
  14. ...state,
  15. isFetchingEvents: true
  16. };
  17. case RECEIVE_EVENTS:
  18. return {
  19. ...state,
  20. isFetchingEvents: false,
  21. events: action.events,
  22. sessions: action.sessions
  23. };
  24. case UPDATE_SORT_STATE :
  25. return {
  26. ...state,
  27. ascending: action.ascending
  28. };
  29. default:
  30. return state;
  31. }
  32. };
  33.  
  34. export default events;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement