Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import configure from './configure';
import appReducer from './reducers';
import './index.css';
/**
* Initialize CMF configuration
* - Register your components in the CMF dictionary
* - Register action creators in CMF actions dictionary
*/
configure.initialize();
/**
* Register react-router-redux router reducer (see https://github.com/reactjs/react-router-redux)
*/
const history = createHistory();
cmfstore.setRouterMiddleware(routerMiddleware(history));
/**
* Register your app reducers
*/
const sagaMiddleware = createSagaMiddleware();
const store = cmfstore.initialize(appReducer, undefined, undefined, [sagaMiddleware]);
/**
* Run main saga
*/
configure.runSagas(sagaMiddleware, history);
/**
* Fetch the CMF settings and configure the CMF app
*/
store.dispatch(actions.settings.fetchSettings('/settings.json'));
function appFactory(storage = {}) {
const { initialState, engine } = storage;
const preReducers = [dataset.preReducers.notificationReducer, ...dataset.hors];
const additionalPreReducers = additionalConfiguration.preReducers;
if (additionalPreReducers) {
preReducers.push(...additionalPreReducers);
}
cmfStore.addPreReducer(preReducers);
/**
* Register react-router-redux router reducer (see https://github.com/reactjs/react-router-redux)
*/
cmfStore.setRouterMiddleware(routerMiddleware(browserHistory));
/**
* Register http middleware
*/
const httpMiddleWareConfig = {
security: {
CSRFTokenCookieKey: 'XSRF-TOKEN',
CSRFTokenHeaderKey: 'X-XSRF-TOKEN',
},
};
cmfSagas.http.setDefaultConfig(httpMiddleWareConfig);
cmfStore.setHttpMiddleware(httpMiddleware(httpMiddleWareConfig));
/**
* Register your app reducers
*/
['cmf', 'components', 'Container(List)', 'preparations'],
['cmf', 'components', 'Container(List)', 'datasets'],
['cmf', 'components', 'Container(List)', 'datastores'],
].concat(additionalLocalStorage.whitelist || []);
const preReducers = [dataset.preReducers.notificationReducer, ...dataset.hors];
const additionalPreReducers = additionalConfiguration.preReducers;
if (additionalPreReducers) {
preReducers.push(...additionalPreReducers);
}
cmfStore.addPreReducer(preReducers);
/**
* Register react-router-redux router reducer (see https://github.com/reactjs/react-router-redux)
*/
cmfStore.setRouterMiddleware(routerMiddleware(browserHistory));
/**
* Register http middleware
*/
const httpMiddleWareConfig = {
security: {
CSRFTokenCookieKey: 'XSRF-TOKEN',
CSRFTokenHeaderKey: 'X-XSRF-TOKEN',
},
};
cmfSagas.http.setDefaultConfig(httpMiddleWareConfig);
cmfStore.setHttpMiddleware(httpMiddleware(httpMiddleWareConfig));
/**
* Register your app reducers
*/