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
78ae2a96
Commit
78ae2a96
authored
Jan 21, 2021
by
Jiwon Yoon
Browse files
?
parent
cdab6bf2
Changes
1
Show whitespace changes
Inline
Side-by-side
client/src/Pages/Payment.js
View file @
78ae2a96
...
@@ -20,6 +20,7 @@ function Payment({ match, location }) {
...
@@ -20,6 +20,7 @@ function Payment({ match, location }) {
const
[
finalPrice
,
setFinalPrice
]
=
useState
(
0
)
const
[
finalPrice
,
setFinalPrice
]
=
useState
(
0
)
const
[
completeState
,
setCompleteState
]
=
useState
(
false
)
const
[
completeState
,
setCompleteState
]
=
useState
(
false
)
const
user
=
isAuthenticated
()
const
user
=
isAuthenticated
()
const
preCart
=
[]
useEffect
(()
=>
{
useEffect
(()
=>
{
getUser
()
getUser
()
...
@@ -45,8 +46,12 @@ function Payment({ match, location }) {
...
@@ -45,8 +46,12 @@ function Payment({ match, location }) {
try
{
try
{
const
response
=
await
axios
.
get
(
`/api/cart/showcart/
${
user
}
`
)
const
response
=
await
axios
.
get
(
`/api/cart/showcart/
${
user
}
`
)
console
.
log
(
response
.
data
)
console
.
log
(
response
.
data
)
if
(
response
.
data
[
0
].
checked
){
const
preCart
=
response
.
data
.
filter
((
el
)
=>
el
.
checked
===
true
)
const
preCart
=
response
.
data
.
filter
((
el
)
=>
el
.
checked
===
true
)
setCart
(
preCart
)
setCart
(
preCart
)
}
else
{
setCart
(
response
.
data
)
}
setOrder
({
products
:
preCart
})
setOrder
({
products
:
preCart
})
}
catch
(
error
)
{
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
catchErrors
(
error
,
setError
)
...
...
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