Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

145 refactor payment #150

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/pages/payment/checkInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default function CheckInfo() {

useEffect(() => {
if (cartItems.length === 0) {
console.log(cartItems)
setBtnActive(true)
} else {
setBtnActive(false)
Expand Down
11 changes: 6 additions & 5 deletions src/pages/payment/orderComplete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ export default function OrderComplete() {

useEffect(() => {
// 랜딩 시 details 저장
matchedTransactionDetails()
// 장바구니에 담겨있던 제품들을 삭제
removeCartItemsByUser(userInfo)
}, [])
matchedTransactionDetails().then(() => {
removeCartItemsByUser(userInfo)
})
}, [userInfo])

const matchedTransactionDetails = async (): Promise<void> => {
// 제품 전체 거래(구매) 내역 API 호출 또는 dummy 데이터 사용
try {
setIsLoading(true)
const transactionDetails: UserTransactionDetails = await getTransactionDetails(accessToken)

// 장바구니에 있는 제품과 비교하여 매칭된 거래 내역 필터링
const matchedDetails = transactionDetails.filter((detail) =>
cartItems.some((item) => item.id === detail.product.productId)
Expand Down Expand Up @@ -73,7 +74,7 @@ export default function OrderComplete() {
)}
<div className={styles.btnContainer}>
<Btn text="계속 쇼핑하기" targetURL="/" />
<Btn text="주문내역 확인하기" targetURL="/user/:username" />
<Btn text="주문내역 확인하기" targetURL={`/user/${userInfo.displayName}/getItemAll`} />
</div>
</>
)
Expand Down