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
fb8518ec
Commit
fb8518ec
authored
Feb 02, 2021
by
Kim, Subin
Browse files
주문자정보 전화번호 유효성 검사 완료
parent
1f9aa29d
Changes
2
Show whitespace changes
Inline
Side-by-side
client/src/Pages/Payment.js
View file @
fb8518ec
...
@@ -220,6 +220,11 @@ function Payment({ match, location }) {
...
@@ -220,6 +220,11 @@ function Payment({ match, location }) {
}
}
}
}
if
(
error
)
{
alert
(
`
${
error
}
`
)
setError
(
''
)
}
return
(
return
(
<
Container
className
=
"
mb-5
"
>
<
Container
className
=
"
mb-5
"
>
<
h3
className
=
"
my-5 font-weight-bold text-center
"
>
주문
/
결제
<
/h3
>
<
h3
className
=
"
my-5 font-weight-bold text-center
"
>
주문
/
결제
<
/h3
>
...
...
server/controllers/order.controller.js
View file @
fb8518ec
...
@@ -6,6 +6,9 @@ import Product from "../schemas/Product.js";
...
@@ -6,6 +6,9 @@ import Product from "../schemas/Product.js";
const
addorder
=
async
(
req
,
res
)
=>
{
const
addorder
=
async
(
req
,
res
)
=>
{
const
{
userId
,
products
,
receiverInfo
,
total
}
=
req
.
body
const
{
userId
,
products
,
receiverInfo
,
total
}
=
req
.
body
try
{
try
{
if
(
!
/^
[
0-9
]{2,3}
-
[
0-9
]{3,4}
-
[
0-9
]{4}
/
.
test
(
receiverInfo
.
tel
))
{
return
res
.
status
(
422
).
send
(
'
유효한 휴대전화번호가 아닙니다. 정확히 입력해주세요.
'
)
}
const
newOrder
=
await
new
Order
({
userId
,
products
,
receiverInfo
,
total
}).
save
()
const
newOrder
=
await
new
Order
({
userId
,
products
,
receiverInfo
,
total
}).
save
()
res
.
status
(
200
).
send
(
'
Order DB에 저장 완료
'
)
res
.
status
(
200
).
send
(
'
Order DB에 저장 완료
'
)
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
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