|
@@ -2,29 +2,31 @@ import {Provider, connect} from 'react-redux';
|
|
|
import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux';
|
|
|
import thunk from 'redux-thunk';
|
|
|
import {actionPromise} from "./index"
|
|
|
-import {gql, actionGoods, getGoods} from "../reducers/index";
|
|
|
+import {gql, actionGoods, getGoods, actionCartAdd} from "../reducers/index";
|
|
|
import { useEffect } from 'react';
|
|
|
-import {OneGood, GoodsList} from "./index";
|
|
|
+import {OneGood, CGoodsList} from "./index";
|
|
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
state: state,
|
|
|
- goods: getGoods(state, "goods", "GoodFind")
|
|
|
+ goods: getGoods(state, "goods", "GoodFind"),
|
|
|
+
|
|
|
});
|
|
|
|
|
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
|
|
- getData: actionGoods
|
|
|
+ getData: actionGoods,
|
|
|
+ onAdd: actionCartAdd
|
|
|
}, dispatch);
|
|
|
|
|
|
|
|
|
|
|
|
-const GoodsCategory = ({goods, id, tittle = "Товари", getData}) => {
|
|
|
+const GoodsCategory = ({goods, id, tittle = "Товари", getData, onAdd}) => {
|
|
|
useEffect(() => getData(id), [id])
|
|
|
return(
|
|
|
<>
|
|
|
<div className = "goodsWrapper">
|
|
|
- <GoodsList arr = {goods}/>
|
|
|
+ <CGoodsList arr = {goods} onAdd = {onAdd}/>
|
|
|
</div>
|
|
|
</>
|
|
|
)
|