You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reducer.js 925B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // @flow
  2. import { ReducerRegistry } from '../base/redux';
  3. import { PersistenceRegistry } from '../base/storage';
  4. import {
  5. SET_SIDEBAR_VISIBLE,
  6. SET_WELCOME_PAGE_LIST_DEFAULT_PAGE
  7. } from './actionTypes';
  8. /**
  9. * The Redux store name this feature uses.
  10. */
  11. const STORE_NAME = 'features/welcome';
  12. /**
  13. * Sets up the persistence of the feature {@code features/welcome}.
  14. */
  15. PersistenceRegistry.register(STORE_NAME, {
  16. defaultPage: true
  17. });
  18. /**
  19. * Reduces redux actions for the purposes of {@code features/welcome}.
  20. */
  21. ReducerRegistry.register(STORE_NAME, (state = {}, action) => {
  22. switch (action.type) {
  23. case SET_SIDEBAR_VISIBLE:
  24. return {
  25. ...state,
  26. sideBarVisible: action.visible
  27. };
  28. case SET_WELCOME_PAGE_LIST_DEFAULT_PAGE:
  29. return {
  30. ...state,
  31. defaultPage: action.pageIndex
  32. };
  33. default:
  34. return state;
  35. }
  36. });