2016-08-18 11:47:26 +02:00
|
|
|
// selectLocationState expects a plain JS object for the routing state
|
2016-08-18 11:41:13 +02:00
|
|
|
const selectLocationState = () => {
|
|
|
|
let prevRoutingState;
|
|
|
|
let prevRoutingStateJS;
|
|
|
|
|
|
|
|
return (state) => {
|
|
|
|
const routingState = state.get('route'); // or state.route
|
|
|
|
|
|
|
|
if (!routingState.equals(prevRoutingState)) {
|
|
|
|
prevRoutingState = routingState;
|
|
|
|
prevRoutingStateJS = routingState.toJS();
|
|
|
|
}
|
|
|
|
|
|
|
|
return prevRoutingStateJS;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-08-18 14:22:12 +02:00
|
|
|
import { createSelector } from 'reselect';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Direct selector to the languageToggle state domain
|
|
|
|
*/
|
|
|
|
const selectApp = () => state => state.get('app');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Select the language locale
|
|
|
|
*/
|
|
|
|
|
|
|
|
const selectPlugins = () => createSelector(
|
|
|
|
selectApp(),
|
|
|
|
(languageState) => languageState.get('plugins')
|
|
|
|
);
|
|
|
|
|
2016-08-18 11:41:13 +02:00
|
|
|
export {
|
2016-08-18 14:22:12 +02:00
|
|
|
selectApp,
|
|
|
|
selectPlugins,
|
2016-08-18 11:41:13 +02:00
|
|
|
selectLocationState,
|
|
|
|
};
|
2016-08-18 14:22:12 +02:00
|
|
|
|