2022-10-13 11:26:28 +03:00
|
|
|
import { APP_WILL_MOUNT } from '../base/app/actionTypes';
|
|
|
|
|
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
2021-09-10 10:00:54 +03:00
|
|
|
|
2021-11-15 10:37:54 +02:00
|
|
|
import { SET_DYNAMIC_BRANDING_DATA } from './actionTypes';
|
2022-05-23 18:02:14 +03:00
|
|
|
import { fetchCustomBrandingData } from './actions.any';
|
2021-11-16 23:16:18 +02:00
|
|
|
import { createMuiBrandingTheme } from './functions.web';
|
2021-09-10 10:00:54 +03:00
|
|
|
|
2022-05-23 18:02:14 +03:00
|
|
|
|
2021-09-10 10:00:54 +03:00
|
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
|
|
|
switch (action.type) {
|
|
|
|
|
case APP_WILL_MOUNT: {
|
|
|
|
|
|
|
|
|
|
store.dispatch(fetchCustomBrandingData());
|
|
|
|
|
break;
|
|
|
|
|
}
|
2021-11-15 10:37:54 +02:00
|
|
|
case SET_DYNAMIC_BRANDING_DATA: {
|
|
|
|
|
const { customTheme } = action.value;
|
|
|
|
|
|
|
|
|
|
if (customTheme) {
|
|
|
|
|
action.value.muiBrandedTheme = createMuiBrandingTheme(customTheme);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-10 10:00:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
|
});
|