mirror of
https://github.com/strapi/strapi.git
synced 2025-11-25 14:41:15 +00:00
37 lines
895 B
JavaScript
37 lines
895 B
JavaScript
import { createSelector } from 'reselect';
|
|
|
|
/**
|
|
* Direct selector to the list state domain
|
|
*/
|
|
|
|
const selectGlobalDomain = () => state => state.get('global');
|
|
|
|
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;
|
|
};
|
|
};
|
|
|
|
const makeSelectSections = () => createSelector(
|
|
selectGlobalDomain(),
|
|
(globalSate) => globalSate.get('sections').toJS(),
|
|
);
|
|
|
|
const makeSelectEnvironments = () => createSelector(
|
|
selectGlobalDomain(),
|
|
(globalSate) => globalSate.get('environments').toJS(),
|
|
);
|
|
|
|
export { selectLocationState, makeSelectSections, makeSelectEnvironments };
|
|
export default selectGlobalDomain;
|