You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
580 B
18 lines
580 B
import { createSelector } from 'reselect';
|
|
import AppState from 'App/State/AppState';
|
|
|
|
function createCollectionSelector() {
|
|
return createSelector(
|
|
(_: AppState, { collectionId }: { collectionId: number }) => collectionId,
|
|
(state: AppState) => state.movieCollections.itemMap,
|
|
(state: AppState) => state.movieCollections.items,
|
|
(collectionId, itemMap, allCollections) => {
|
|
return allCollections && itemMap && collectionId in itemMap
|
|
? allCollections[itemMap[collectionId]]
|
|
: undefined;
|
|
}
|
|
);
|
|
}
|
|
|
|
export default createCollectionSelector;
|