From e75fe995f083d5389b1ad83e86f9042bf7275f8d Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Tue, 28 Nov 2017 19:05:23 +0200 Subject: [PATCH] Selector: getTransactionsById (similar as getListingsById) --- src/ducks/marketplaceData.duck.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ducks/marketplaceData.duck.js b/src/ducks/marketplaceData.duck.js index e15919e0..83cf3632 100644 --- a/src/ducks/marketplaceData.duck.js +++ b/src/ducks/marketplaceData.duck.js @@ -68,6 +68,17 @@ export const getMarketplaceEntities = (state, entityRefs) => { } }; +/** + * Get the denormalised transaction entities with the given IDs + * + * @param {Object} state the full Redux store + * @param {Array} transactionIds transaction IDs to select from the store + */ +export const getTransactionsById = (state, transactionIds) => { + const entityRefs = transactionIds.map(id => ({ id, type: 'transaction' })); + return getMarketplaceEntities(state, entityRefs); +}; + // ================ Action creators ================ // export const addMarketplaceEntities = apiResponse => ({