您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

reducer.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // @flow
  2. import { ReducerRegistry } from '../base/redux';
  3. import { SET_DYNAMIC_BRANDING_DATA, SET_DYNAMIC_BRANDING_READY } from './actionTypes';
  4. /**
  5. * The name of the redux store/state property which is the root of the redux
  6. * state of the feature {@code dynamic-branding}.
  7. */
  8. const STORE_NAME = 'features/dynamic-branding';
  9. const DEFAULT_STATE = {
  10. backgroundColor: '',
  11. backgroundImageUrl: '',
  12. customizationReady: false,
  13. logoClickUrl: '',
  14. logoImageUrl: ''
  15. };
  16. /**
  17. * Reduces redux actions for the purposes of the feature {@code dynamic-branding}.
  18. */
  19. ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
  20. switch (action.type) {
  21. case SET_DYNAMIC_BRANDING_DATA: {
  22. const { backgroundColor, backgroundImageUrl, logoClickUrl, logoImageUrl } = action.value;
  23. return {
  24. backgroundColor,
  25. backgroundImageUrl,
  26. logoClickUrl,
  27. logoImageUrl,
  28. customizationReady: true
  29. };
  30. }
  31. case SET_DYNAMIC_BRANDING_READY:
  32. return {
  33. ...state,
  34. customizationReady: true
  35. };
  36. }
  37. return state;
  38. });