Guest User

Untitled

a guest
Jul 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import { appActions } from '../actions/app';
  2.  
  3. const initialState = {
  4. app: {
  5. isBootstrapped: false,
  6. },
  7. };
  8.  
  9. const commonReducer = (state = initialState, action) => {
  10. switch (action.type) {
  11. case appActions.BOOTSTRAP_APP:
  12. return {
  13. ...state,
  14. app: {
  15. ...state.app,
  16. isBootstrapped: false,
  17. },
  18. };
  19. case appActions.BOOTSTRAP_APP_SUCCESS:
  20. return {
  21. ...state,
  22. app: {
  23. ...state.app,
  24. isBootstrapped: true,
  25. bootstrapError: false,
  26. },
  27. };
  28. case appActions.BOOTSTRAP_APP_ERROR:
  29. return {
  30. ...state,
  31. app: {
  32. ...state.app,
  33. isBootstrapped: false,
  34. bootstrapError: true,
  35. },
  36. };
  37. default:
  38. return state;
  39. }
  40. };
  41.  
  42. export default commonReducer;
Add Comment
Please, Sign In to add comment