|
@@ -4,13 +4,13 @@ import thunk from 'redux-thunk';
|
|
|
import {actionPromise} from "./index"
|
|
|
import {gql, actionGoods, getGoods} from "../reducers/index";
|
|
|
import { useEffect } from 'react';
|
|
|
-import {OneGood, CGoodsList} from "./index";
|
|
|
+import {OneGood, GoodsList} from "./index";
|
|
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
state: state,
|
|
|
- goods: getGoods(state)
|
|
|
+ goods: getGoods(state, "goods")
|
|
|
});
|
|
|
|
|
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
|
@@ -19,24 +19,12 @@ import {OneGood, CGoodsList} from "./index";
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-// const GoodsList = ({goods = [], className = "goods"}) => {
|
|
|
-// return (
|
|
|
-// <div className = {className}>
|
|
|
-// {goods.map((good) => <OneGood key = {good._id} name = {good.name} price = {good.price} image = {good.images[0].url}/>)}
|
|
|
-// </div>
|
|
|
-// )
|
|
|
-// }
|
|
|
-
|
|
|
-// const CGoodsList = connect(mapStateToProps, mapDispatchToProps)(GoodsList);
|
|
|
-
|
|
|
-
|
|
|
-const GoodsCategory = ({id, tittle = "Товари", getData}) => {
|
|
|
+const GoodsCategory = ({goods, id, tittle = "Товари", getData}) => {
|
|
|
useEffect(() => getData(id), [id])
|
|
|
return(
|
|
|
<>
|
|
|
<div className = "goodsWrapper">
|
|
|
- <CGoodsList />
|
|
|
+ <GoodsList arr = {goods}/>
|
|
|
</div>
|
|
|
</>
|
|
|
)
|