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