2017-06-06 17:19:12 -04:00
|
|
|
import { createSelector } from "reselect";
|
2017-04-28 22:14:44 +07:00
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
export const _selectState = state => state.costInfo || {};
|
2017-04-28 22:14:44 +07:00
|
|
|
|
|
|
|
export const selectAllCostInfoByUri = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 17:19:12 -04:00
|
|
|
state => state.byUri || {}
|
2017-06-05 21:21:55 -07:00
|
|
|
);
|
2017-04-28 22:14:44 +07:00
|
|
|
|
2017-05-14 23:50:59 -04:00
|
|
|
export const selectCostInfoForUri = (state, props) => {
|
2017-06-06 17:19:12 -04:00
|
|
|
return selectAllCostInfoByUri(state)[props.uri];
|
2017-06-05 21:21:55 -07:00
|
|
|
};
|
2017-04-30 00:02:25 +07:00
|
|
|
|
|
|
|
export const makeSelectCostInfoForUri = () => {
|
2017-06-06 17:19:12 -04:00
|
|
|
return createSelector(selectCostInfoForUri, costInfo => costInfo);
|
2017-06-05 21:21:55 -07:00
|
|
|
};
|
2017-05-28 19:16:07 +04:00
|
|
|
|
|
|
|
export const selectFetchingCostInfo = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 17:19:12 -04:00
|
|
|
state => state.fetching || {}
|
2017-06-05 21:21:55 -07:00
|
|
|
);
|
2017-05-28 19:16:07 +04:00
|
|
|
|
|
|
|
const selectFetchingCostInfoForUri = (state, props) => {
|
2017-06-06 17:19:12 -04:00
|
|
|
return selectFetchingCostInfo(state)[props.uri];
|
2017-06-05 21:21:55 -07:00
|
|
|
};
|
2017-05-28 19:16:07 +04:00
|
|
|
|
|
|
|
export const makeSelectFetchingCostInfoForUri = () => {
|
2017-06-06 17:19:12 -04:00
|
|
|
return createSelector(selectFetchingCostInfoForUri, fetching => !!fetching);
|
2017-06-05 21:21:55 -07:00
|
|
|
};
|