Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

reducer.js 921B

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