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

123456789101112131415161718192021222324252627
  1. import {
  2. SET_CONFIG
  3. } from '../config';
  4. import { ReducerRegistry, set } from '../redux';
  5. import { validateLastNLimits } from './functions';
  6. ReducerRegistry.register('features/base/lastn', (state = { }, action) => {
  7. switch (action.type) {
  8. case SET_CONFIG:
  9. return _setConfig(state, action);
  10. }
  11. return state;
  12. });
  13. /**
  14. * Reduces a specific Redux action SET_CONFIG.
  15. *
  16. * @param {Object} state - The Redux state of feature base/lastn.
  17. * @param {Action} action - The Redux action SET_CONFIG to reduce.
  18. * @private
  19. * @returns {Object} The new state after the reduction of the specified action.
  20. */
  21. function _setConfig(state, { config }) {
  22. return set(state, 'lastNLimits', validateLastNLimits(config.lastNLimits));
  23. }