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 887B

123456789101112131415161718192021222324252627282930313233343536
  1. // @flow
  2. import { PersistenceRegistry, ReducerRegistry, set } from '../base/redux';
  3. import {
  4. SET_SIDEBAR_VISIBLE,
  5. SET_WELCOME_PAGE_LISTS_DEFAULT_PAGE
  6. } from './actionTypes';
  7. /**
  8. * The name of the redux store/state property which is the root of the redux
  9. * state of the feature {@code welcome}.
  10. */
  11. const STORE_NAME = 'features/welcome';
  12. /**
  13. * Sets up the persistence of the feature {@code welcome}.
  14. */
  15. PersistenceRegistry.register(STORE_NAME, {
  16. defaultPage: true
  17. });
  18. /**
  19. * Reduces redux actions for the purposes of the feature {@code welcome}.
  20. */
  21. ReducerRegistry.register(STORE_NAME, (state = {}, action) => {
  22. switch (action.type) {
  23. case SET_SIDEBAR_VISIBLE:
  24. return set(state, 'sideBarVisible', action.visible);
  25. case SET_WELCOME_PAGE_LISTS_DEFAULT_PAGE:
  26. return set(state, 'defaultPage', action.pageIndex);
  27. }
  28. return state;
  29. });