mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 13:06:03 +10:00
Rename addEntities to addMarketplaceEntities
This commit is contained in:
parent
6354600d34
commit
6f3d8efb0d
8 changed files with 20 additions and 20 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { addEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { createStripeAccount } from '../../ducks/user.duck';
|
||||
|
||||
const requestAction = actionType => params => ({ type: actionType, payload: { params } });
|
||||
|
|
@ -132,7 +132,7 @@ export function requestShowListing(actionPayload) {
|
|||
.show(actionPayload)
|
||||
.then(response => {
|
||||
// EditListingPage fetches new listing data, which also needs to be added to global data
|
||||
dispatch(addEntities(response));
|
||||
dispatch(addMarketplaceEntities(response));
|
||||
// In case of success, we'll clear state.EditListingPage (user will be redirected away)
|
||||
dispatch(showListingsSuccess(response));
|
||||
return response;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { reverse, sortBy } from 'lodash';
|
||||
import { parse } from '../../util/urlHelpers';
|
||||
import { addEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { fetchCurrentUser } from '../../ducks/user.duck';
|
||||
|
||||
const sortedTransactions = txs =>
|
||||
|
|
@ -152,7 +152,7 @@ export const loadData = (params, search) =>
|
|||
return sdk.transactions
|
||||
.query(apiQueryParams)
|
||||
.then(response => {
|
||||
dispatch(addEntities(response));
|
||||
dispatch(addMarketplaceEntities(response));
|
||||
dispatch(fetchOrdersOrSalesSuccess(response));
|
||||
return response;
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { addEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { fetchCurrentUser } from '../../ducks/user.duck';
|
||||
|
||||
// ================ Action types ================ //
|
||||
|
|
@ -47,7 +47,7 @@ export const showListing = listingId =>
|
|||
return sdk.listings
|
||||
.show({ id: listingId, include: ['author', 'images'] })
|
||||
.then(data => {
|
||||
dispatch(addEntities(data));
|
||||
dispatch(addMarketplaceEntities(data));
|
||||
return data;
|
||||
})
|
||||
.catch(e => {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { types } from '../../util/sdkLoader';
|
|||
import { createUser, createCurrentUser, createListing, fakeIntl } from '../../util/test-data';
|
||||
import { renderShallow } from '../../util/test-helpers';
|
||||
import { ListingPageComponent } from './ListingPage';
|
||||
import { addEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { showListingRequest, showListingError, showListing } from './ListingPage.duck';
|
||||
|
||||
const { UUID } = types;
|
||||
|
|
@ -46,7 +46,7 @@ describe('ListingPage', () => {
|
|||
expect(dispatch.mock.calls).toEqual([
|
||||
[showListingRequest(id)],
|
||||
[expect.anything()], // fetchCurrentUser() call
|
||||
[addEntities(data)],
|
||||
[addMarketplaceEntities(data)],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { types } from '../../util/sdkLoader';
|
||||
import { addEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
|
||||
// ================ Action types ================ //
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ export const fetchOrder = id =>
|
|||
return sdk.transactions
|
||||
.show({ id, include: ['customer', 'provider', 'listing', 'booking'] }, { expand: true })
|
||||
.then(response => {
|
||||
dispatch(addEntities(response));
|
||||
dispatch(addMarketplaceEntities(response));
|
||||
dispatch(fetchOrderSuccess(response));
|
||||
return response;
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { types } from '../../util/sdkLoader';
|
||||
import { addEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
|
||||
// Transition-to keys
|
||||
const TRANSITION_ACCEPT = 'transition/accept';
|
||||
|
|
@ -87,7 +87,7 @@ export const fetchSale = id =>
|
|||
return sdk.transactions
|
||||
.show({ id, include: ['customer', 'provider', 'listing', 'booking'] }, { expand: true })
|
||||
.then(response => {
|
||||
dispatch(addEntities(response));
|
||||
dispatch(addMarketplaceEntities(response));
|
||||
dispatch(fetchSaleSuccess(response));
|
||||
return response;
|
||||
})
|
||||
|
|
@ -104,7 +104,7 @@ export const acceptSale = id =>
|
|||
return sdk.transactions
|
||||
.transition({ id, transition: TRANSITION_ACCEPT, params: {} }, { expand: true })
|
||||
.then(response => {
|
||||
dispatch(addEntities(response));
|
||||
dispatch(addMarketplaceEntities(response));
|
||||
dispatch(acceptSaleSuccess());
|
||||
return response;
|
||||
})
|
||||
|
|
@ -121,7 +121,7 @@ export const rejectSale = id =>
|
|||
return sdk.transactions
|
||||
.transition({ id, transition: TRANSITION_REJECT, params: {} }, { expand: true })
|
||||
.then(response => {
|
||||
dispatch(addEntities(response));
|
||||
dispatch(addMarketplaceEntities(response));
|
||||
dispatch(rejectSaleSuccess());
|
||||
return response;
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { addEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
|
||||
// ================ Action types ================ //
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ export const searchListings = searchParams =>
|
|||
|
||||
return searchOrQuery
|
||||
.then(response => {
|
||||
dispatch(addEntities(response));
|
||||
dispatch(addMarketplaceEntities(response));
|
||||
dispatch(searchListingsSuccess(response));
|
||||
return response;
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { updatedEntities, denormalisedEntities } from '../util/data';
|
|||
|
||||
// ================ Action types ================ //
|
||||
|
||||
const ADD_ENTITIES = 'app/sdk/ADD_ENTITIES';
|
||||
export const ADD_MARKETPLACE_ENTITIES = 'app/marketplaceData/ADD_MARKETPLACE_ENTITIES';
|
||||
|
||||
// ================ Reducer ================ //
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ const merge = (state, apiResponse) => {
|
|||
export default function marketplaceDataReducer(state = initialState, action = {}) {
|
||||
const { type, payload } = action;
|
||||
switch (type) {
|
||||
case ADD_ENTITIES:
|
||||
case ADD_MARKETPLACE_ENTITIES:
|
||||
return merge(state, payload);
|
||||
|
||||
default:
|
||||
|
|
@ -69,7 +69,7 @@ export const getEntities = (marketplaceData, entityRefs) => {
|
|||
|
||||
// ================ Action creators ================ //
|
||||
|
||||
export const addEntities = apiResponse => ({
|
||||
type: ADD_ENTITIES,
|
||||
export const addMarketplaceEntities = apiResponse => ({
|
||||
type: ADD_MARKETPLACE_ENTITIES,
|
||||
payload: apiResponse,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue