Guest User

Untitled

a guest
Jun 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import * as t from './actionTypes'
  2.  
  3. export const initialState = {
  4. data: null,
  5. isLoading: false,
  6. errorMsg: null,
  7. }
  8.  
  9. export default (state, action) => {
  10. switch (action.type) {
  11. case t.NEWS_GET_REQUEST:
  12. return {
  13. ...state,
  14. isLoading: true,
  15. errorMsg: null,
  16. }
  17. case t.NEWS_GET_SUCCESS:
  18. return {
  19. ...state,
  20. isLoading: false,
  21. data: action.payload,
  22. }
  23. case t.NEWS_GET_FAILURE:
  24. return {
  25. ...state,
  26. errorMsg: action.payload.errorMsg,
  27. }
  28. default:
  29. return state
  30. }
  31. }
Add Comment
Please, Sign In to add comment