|
@@ -6,6 +6,7 @@ import { useDispatch,useSelector } from 'react-redux';
|
|
|
|
|
|
|
|
|
import s from './DetailGood.module.css';
|
|
|
+import { makeOrderById } from '../../../api-data'
|
|
|
import { asyncGetGoodById } from '../../../redux/goods/operations';
|
|
|
import { getGood} from '../../../redux/goods/selector';
|
|
|
|
|
@@ -19,15 +20,19 @@ function DetailCategory() {
|
|
|
dispatch(asyncGetGoodById(id))
|
|
|
}, [dispatch, id]);
|
|
|
|
|
|
+ const handlePurchase = () => makeOrderById("5dc4b2553f23b553bf3540fc")
|
|
|
+console.log(good[0])
|
|
|
|
|
|
return (
|
|
|
good.length !== 0 &&(
|
|
|
<div className={s.detailGood_wrapper}>
|
|
|
<p>name : {good[0].name?good[0].name:'missed'}</p>
|
|
|
- <p>createdAt : {good[0].createdAt?good[0].createdAt:'missed'}</p>
|
|
|
+ <p>createdAt : {good[0].createdAt ? good[0].createdAt : 'missed'}</p>
|
|
|
+ <p>price : {good[0].price?good[0].price:'missed'}</p>
|
|
|
<p>description : {good[0].description?good[0].description:'missed'}</p>
|
|
|
<img src={`http://shop-roles.asmer.fs.a-level.com.ua/${good[0].images&&good[0].images[0].url}`}
|
|
|
alt='*it has to be pic of product*' width='200' height='200'></img>
|
|
|
+ <button onClick={handlePurchase} className={s.detailGoodBtn} type='button'>Purchase</button>
|
|
|
</div>
|
|
|
)
|
|
|
)
|