mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-27 19:42:11 +10:00
Review: Use generic getMarketplaceEntities instead
This commit is contained in:
parent
e2813fb346
commit
c8994c11ed
2 changed files with 3 additions and 17 deletions
|
|
@ -7,7 +7,7 @@ import { connect } from 'react-redux';
|
|||
import { types as sdkTypes } from '../../util/sdkLoader';
|
||||
import { createSlug } from '../../util/urlHelpers';
|
||||
import { propTypes } from '../../util/types';
|
||||
import { getOwnListingsById } from '../../ducks/marketplaceData.duck';
|
||||
import { getMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { manageDisableScrolling, isScrollingDisabled } from '../../ducks/UI.duck';
|
||||
import { stripeAccountClearError, createStripeAccount } from '../../ducks/user.duck';
|
||||
import { EditListingWizard, NamedRedirect, Page } from '../../components';
|
||||
|
|
@ -216,7 +216,8 @@ const mapStateToProps = state => {
|
|||
const fetchInProgress = createStripeAccountInProgress;
|
||||
|
||||
const getListing = id => {
|
||||
const listings = getOwnListingsById(state, [id]);
|
||||
const listings = getMarketplaceEntities(state, [{ id, type: 'ownListing' }]);
|
||||
|
||||
return listings.length === 1 ? listings[0] : null;
|
||||
};
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -46,21 +46,6 @@ export const getListingsById = (state, listingIds) => {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the denormalised ownListing entities with the given IDs
|
||||
*
|
||||
* @param {Object} state the full Redux store
|
||||
* @param {Array<UUID>} listingIds listing IDs to select from the store
|
||||
*/
|
||||
export const getOwnListingsById = (state, listingIds) => {
|
||||
const { entities } = state.marketplaceData;
|
||||
try {
|
||||
return denormalisedEntities(entities, 'ownListing', listingIds);
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the denormalised entities from the given entity references.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue