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'; ...@@ -4,10 +4,23 @@ import { Row, Col, Form, Card, Button } from 'react-bootstrap';
import catchErrors from '../utils/catchErrors'; import catchErrors from '../utils/catchErrors';
function Product() { function Product() {
const [product, setProduct] = useState()
const [select, setSelect] = useState({ color: "", size: "" }) const [select, setSelect] = useState({ color: "", size: "" })
const [cart, setCart] = useState() const [cart, setCart] = useState()
const [error, setError] = 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) { function handleClick(e) {
const box = e.target.parentNode.parentNode const box = e.target.parentNode.parentNode
box.style.display = "none" box.style.display = "none"
...@@ -73,10 +86,12 @@ function Product() { ...@@ -73,10 +86,12 @@ function Product() {
useEffect(() => { useEffect(() => {
handleCreate() handleCreate()
getProduct()
}, [cart]) }, [cart])
return ( return (
<div> <div>
{/* {getProduct} */}
<style type="text/css"> <style type="text/css">
{` {`
.btn { .btn {
......
...@@ -40,11 +40,11 @@ function ProductsList() { ...@@ -40,11 +40,11 @@ function ProductsList() {
`} `}
</style> </style>
<Container> <Container>
<Row > <Row className="justify-content-center" >
<Col sm={10} xs={12}> <Col sm={10} xs={12} >
<h1 style={{ fontSize: "3rem" }} className="text-center">OUTER</h1> <h1 style={{ fontSize: "3rem" }} className="text-center">OUTER</h1>
<div>{sub.map((ele) => ( <div className="text-center">{sub.map((ele) => (
<Button className="justify-content-center m-1">{ele}</Button> <Button className="m-1">{ele}</Button>
))}</div> ))}</div>
</Col> </Col>
</Row> </Row>
......
...@@ -28,4 +28,9 @@ const regist = async (req, res) => { ...@@ -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() ...@@ -10,5 +10,7 @@ const router = express.Router()
router.route('/regist') router.route('/regist')
.post(productCtrl.fileUpload, productCtrl.regist) .post(productCtrl.fileUpload, productCtrl.regist)
router.route('/productone')
.get(productCtrl.getProduct)
export default router 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