Commit 0ed13690 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

0111 마지막

parent c4db43eb
node_modules
\ No newline at end of file
......@@ -4,10 +4,23 @@ import { Row, Col, Form, Card, Button } from 'react-bootstrap';
import catchErrors from '../utils/catchErrors';
function Product() {
const [product, setProduct] = useState()
const [select, setSelect] = useState({ color: "", size: "" })
const [cart, setCart] = useState()
const [error, setError] = useState('')
async function getProduct(user){
console.log(user)
try {
const response = await axios.get('/api/product/productone')
setProduct(response.data)
console.log(response.data)
} catch (error) {
catchErrors(error, setError)
}
}
function handleClick(e) {
const box = e.target.parentNode.parentNode
box.style.display = "none"
......@@ -73,10 +86,12 @@ function Product() {
useEffect(() => {
handleCreate()
getProduct()
}, [cart])
return (
<div>
{/* {getProduct} */}
<style type="text/css">
{`
.btn {
......
......@@ -40,11 +40,11 @@ function ProductsList() {
`}
</style>
<Container>
<Row >
<Col sm={10} xs={12}>
<Row className="justify-content-center" >
<Col sm={10} xs={12} >
<h1 style={{ fontSize: "3rem" }} className="text-center">OUTER</h1>
<div>{sub.map((ele) => (
<Button className="justify-content-center m-1">{ele}</Button>
<div className="text-center">{sub.map((ele) => (
<Button className="m-1">{ele}</Button>
))}</div>
</Col>
</Row>
......
......@@ -7,7 +7,7 @@ const upload = multer({ dest: 'uploads/'});
const fileUpload = upload.fields([
{ name: 'main_image', maxCount: 1 },
{ name: 'detail_image', maxCount: 1 }
])
])
const regist = async (req, res) => {
console.log('req.body=', req.body)
......@@ -28,4 +28,9 @@ const regist = async (req, res) => {
}
}
export default { regist, fileUpload }
\ No newline at end of file
const getProduct = (req, res) => {
res.json(req.body)
}
export default { regist, fileUpload , getProduct}
\ No newline at end of file
......@@ -10,5 +10,7 @@ const router = express.Router()
router.route('/regist')
.post(productCtrl.fileUpload, productCtrl.regist)
router.route('/productone')
.get(productCtrl.getProduct)
export default router
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment