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

middleware.web.ts 730B

1234567891011121314151617181920212223242526
  1. import { APP_WILL_MOUNT } from '../base/app/actionTypes';
  2. import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
  3. import { SET_DYNAMIC_BRANDING_DATA } from './actionTypes';
  4. import { fetchCustomBrandingData } from './actions.any';
  5. import { createMuiBrandingTheme } from './functions.web';
  6. MiddlewareRegistry.register(store => next => action => {
  7. switch (action.type) {
  8. case APP_WILL_MOUNT: {
  9. store.dispatch(fetchCustomBrandingData());
  10. break;
  11. }
  12. case SET_DYNAMIC_BRANDING_DATA: {
  13. const { customTheme } = action.value;
  14. if (customTheme) {
  15. action.value.muiBrandedTheme = createMuiBrandingTheme(customTheme);
  16. }
  17. }
  18. }
  19. return next(action);
  20. });