test
This commit is contained in:
@@ -73,7 +73,7 @@ class Wiaas_REST_Customer_API {
|
||||
|
||||
$customer_shops = array_map(function($customer_shop) {
|
||||
return array(
|
||||
'id' => $customer_shop['owner_id'],
|
||||
'id' => absint($customer_shop['owner_id']),
|
||||
'type' => $customer_shop['order_type'],
|
||||
'name' => wiaas_get_organization_name($customer_shop['owner_id'])
|
||||
);
|
||||
|
||||
@@ -74,7 +74,6 @@ export const fetchShops = (userId) => {
|
||||
|
||||
if (shopOptions.length) {
|
||||
dispatch(selectShop(shopOptions[0]));
|
||||
dispatch(fetchShopPackages(shopOptions[0]));
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import ShopItem from './components/ShopItem.jsx';
|
||||
import WiaasBox from '../../mainComponents/box/WiaasBox.jsx';
|
||||
import CoMarketNavContainer from './CoMarketNavContainer.jsx';
|
||||
import {fetchShopPackages} from '../../actions/coMarket/coMarketPackagesActions';
|
||||
import {fetchShopPackages, selectShop} from '../../actions/coMarket/coMarketPackagesActions';
|
||||
|
||||
class CoMarketPackagesContainer extends Component {
|
||||
componentDidMount() {
|
||||
@@ -17,6 +17,13 @@ class CoMarketPackagesContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps){
|
||||
if (nextProps.selectedShop &&
|
||||
(!this.props.selectedShop || this.props.selectedShop.id !== nextProps.selectedShop.id)) {
|
||||
this.props.dispatch(fetchShopPackages(nextProps.selectedShop));
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {shopPackages, selectedShop, isLoading} = this.props;
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ class CoMarketCatalogSelect extends Component {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps){
|
||||
// if(nextProps.activeModule==='cart' && nextProps.shops && nextProps.cartItems && nextProps.cartItems.length > 0){
|
||||
// const cartShop = this.props.shops.find( shop => { return shop.id === this.props.cartItems[0].idCommercialLead });
|
||||
// nextProps.dispatch(selectShop(cartShop));
|
||||
// }
|
||||
if(nextProps.activeModule==='cart' && nextProps.shops && nextProps.cartItems && nextProps.cartItems.length > 0){
|
||||
const cartShop = nextProps.shops.find( shop => { return shop.id === nextProps.cartItems[0].idCommercialLead });
|
||||
nextProps.dispatch(selectShop(cartShop));
|
||||
}
|
||||
|
||||
if(nextProps.shops && nextProps.idCommercialLead && nextProps.activeModule === 'co-market'){
|
||||
const shop = nextProps.shops.find( shop => {return shop.id === nextProps.idCommercialLead });
|
||||
|
||||
Reference in New Issue
Block a user