Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
shopping-mall
Commits
0ed13690
Commit
0ed13690
authored
Jan 11, 2021
by
Jiwon Yoon
Browse files
0111 마지막
parent
c4db43eb
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitignore
deleted
100644 → 0
View file @
c4db43eb
node_modules
\ No newline at end of file
client/src/Pages/Product.js
View file @
0ed13690
...
@@ -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 {
...
...
client/src/Pages/ProductsList.js
View file @
0ed13690
...
@@ -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
>
...
...
server/controllers/product.controller.js
View file @
0ed13690
...
@@ -7,7 +7,7 @@ const upload = multer({ dest: 'uploads/'});
...
@@ -7,7 +7,7 @@ const upload = multer({ dest: 'uploads/'});
const
fileUpload
=
upload
.
fields
([
const
fileUpload
=
upload
.
fields
([
{
name
:
'
main_image
'
,
maxCount
:
1
},
{
name
:
'
main_image
'
,
maxCount
:
1
},
{
name
:
'
detail_image
'
,
maxCount
:
1
}
{
name
:
'
detail_image
'
,
maxCount
:
1
}
])
])
const
regist
=
async
(
req
,
res
)
=>
{
const
regist
=
async
(
req
,
res
)
=>
{
console
.
log
(
'
req.body=
'
,
req
.
body
)
console
.
log
(
'
req.body=
'
,
req
.
body
)
...
@@ -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
server/routes/product.routes.js
View file @
0ed13690
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment