Skip to content

Commit

Permalink
fix: 배송지 없을 경우 에러처리
Browse files Browse the repository at this point in the history
fix: 배송지 없을 경우 에러처리
  • Loading branch information
jeongs9203 authored Nov 30, 2023
2 parents d7a3de1 + 228bf73 commit a6aa6e9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
45 changes: 26 additions & 19 deletions src/components/CheckoutList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,30 +237,37 @@ export default function CheckoutList() {

const handlePayment = (data: boolean) => {
if (session.status === 'authenticated') {
setPaymentClicked(data);
// setPrice(price);
if (deliveryOrdersInRequest.recipientAddress) {

if (paymentList && deliveryOrdersInRequest && vendorsOrderList) {
setPaymentProduct(paymentList);
setPaymentClicked(data);
// setPrice(price);

localStorage.setItem('paymentProduct', JSON.stringify(paymentList));
if (paymentList && deliveryOrdersInRequest && vendorsOrderList) {
setPaymentProduct(paymentList);

localStorage.setItem(
'deliveryOrdersInRequest',
JSON.stringify(deliveryOrdersInRequest)
);
localStorage.setItem('paymentProduct', JSON.stringify(paymentList));

localStorage.setItem(
'vendorsOrderListInRequest',
JSON.stringify(vendorsOrderList)
);
localStorage.setItem(
'deliveryOrdersInRequest',
JSON.stringify(deliveryOrdersInRequest)
);

localStorage.setItem(
'productInCartId',
JSON.stringify(
extractMatchingProductInCartIds(cartBrandProducts, cartId)
)
);
localStorage.setItem(
'vendorsOrderListInRequest',
JSON.stringify(vendorsOrderList)
);

localStorage.setItem(
'productInCartId',
JSON.stringify(
extractMatchingProductInCartIds(cartBrandProducts, cartId)
)
);
}
} else {
toast.custom((t) => (
<Toast message="배송지 정보를 선택해주세요." />
));
}
} else {
toast.custom((t) => (
Expand Down
1 change: 1 addition & 0 deletions src/components/PaymentSuccess.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React, { useEffect, useState } from 'react';

function PaymentSuccess() {
const session = useSession();
console.log(session.data?.user.userEmail)
const token = session?.data?.user.accessToken;
const userEmail = session?.data?.user.userEmail;
const param = useSearchParams();
Expand Down

0 comments on commit a6aa6e9

Please sign in to comment.