How to use the @talend/react-cmf.store.setRouterMiddleware function in @talend/react-cmf

To help you get started, we’ve selected a few @talend/react-cmf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Talend / data-prep / dataprep-webapp-cmf / src / app / index.js View on Github external
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'));
github Talend / data-prep / dataprep-webapp / src / app / configure.cmf.js View on Github external
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
		 */
github Talend / data-prep / dataprep-webapp / src / app / configure.cmf.js View on Github external
['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
	 */