Commit 78ae2a96 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

?

parent cdab6bf2
...@@ -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)
const preCart = response.data.filter((el) => el.checked === true) if(response.data[0].checked){
setCart(preCart) const preCart = response.data.filter((el) => el.checked === true)
setCart(preCart)
} else {
setCart(response.data)
}
setOrder({ products: preCart }) setOrder({ products: preCart })
} catch (error) { } catch (error) {
catchErrors(error, setError) catchErrors(error, setError)
......
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