Files
jitsi-meet/react/features/dynamic-branding/middleware.js
Horatiu Muresan 8ebca64af1 feat(dynamic-branding): Add custom theme branding (#10335)
- apply theming to various buttons
2021-11-15 10:37:54 +02:00

28 lines
704 B
JavaScript

// @flow
import { APP_WILL_MOUNT } from '../base/app';
import { MiddlewareRegistry } from '../base/redux';
import { SET_DYNAMIC_BRANDING_DATA } from './actionTypes';
import { fetchCustomBrandingData } from './actions';
import { createMuiBrandingTheme } from './functions';
MiddlewareRegistry.register(store => next => action => {
switch (action.type) {
case APP_WILL_MOUNT: {
store.dispatch(fetchCustomBrandingData());
break;
}
case SET_DYNAMIC_BRANDING_DATA: {
const { customTheme } = action.value;
if (customTheme) {
action.value.muiBrandedTheme = createMuiBrandingTheme(customTheme);
}
}
}
return next(action);
});