From 21f081f45f365651933bb8db6031b779a8357d75 Mon Sep 17 00:00:00 2001 From: hojin Date: Sun, 8 Sep 2024 20:56:17 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EA=B2=B0=EC=A0=9C=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20=EB=B0=98=EC=9D=91?= =?UTF-8?q?=ED=98=95=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/payment/check/confirm/page.tsx | 6 ++--- .../payment/check/confirm/success/page.tsx | 27 ++----------------- src/components/common/MobileFooter.tsx | 2 +- src/components/modal/CouponModal.tsx | 6 +---- src/components/modal/Quitmodal.tsx | 2 +- src/components/payment/PaymentCheckIndex.tsx | 2 +- src/components/payment/PaymentIndex.tsx | 4 +-- 7 files changed, 10 insertions(+), 39 deletions(-) diff --git a/src/app/payment/check/confirm/page.tsx b/src/app/payment/check/confirm/page.tsx index 5eee4a6..f7b09cd 100644 --- a/src/app/payment/check/confirm/page.tsx +++ b/src/app/payment/check/confirm/page.tsx @@ -6,7 +6,7 @@ import { loadPaymentWidget } from '@tosspayments/payment-widget-sdk'; import { useAsync } from 'react-use'; -import { useRouter, useSearchParams } from 'next/navigation'; +import { useSearchParams } from 'next/navigation'; import { useMemberStore } from '@/store/user.store'; import LoaderSkeleton from '@/components/skeleton/LoaderSkeleton'; @@ -14,11 +14,9 @@ const clientKey = 'test_gck_docs_Ovk5rk1EwkEbP0W43n07xlzm'; const PaymentConfirmPage = () => { const { member } = useMemberStore(); - const router = useRouter(); const searchParams = useSearchParams(); const price = searchParams.get('totalAmount') || '0'; const orderTitle = searchParams.get('orderTitle') as string; - //paytodo : 유저 id 추가하기 const customerKey = searchParams.get('customerKey') as string; const paymentWidgetRef = useRef(null); const paymentMethodsWidgetRef = useRef { return ( -
+

확인 및 결제

diff --git a/src/app/payment/check/confirm/success/page.tsx b/src/app/payment/check/confirm/success/page.tsx index 7c4405b..d230914 100644 --- a/src/app/payment/check/confirm/success/page.tsx +++ b/src/app/payment/check/confirm/success/page.tsx @@ -26,7 +26,7 @@ interface PaymentResponseProps { }; type?: string; totalAmount: number; - method?: '카드' | '가상계좌' | '계좌이체'; + method?: '카드' | '가상계좌' | '계좌이체' | '간편결제'; } interface ParamsProps { @@ -77,21 +77,7 @@ async function getPayment({ paymentKey, orderId, amount }: PaymentRequestProps) ); if (payment) { - await axios.patch(`${process.env.NEXT_PUBLIC_API_URL}/api/payments`, { - orderId: orderId, - paymentKey: paymentKey, - amount: amount, - bookingStatus: 'SUCCESS', - status: payment.status, - method: payment?.method, - receiptUrl: payment?.receipt?.url, - approvedAt: payment?.approvedAt, - cardNumber: payment?.card?.number, - cardType: payment?.card?.cardType, - type: payment?.type, - mId: payment?.mId, - checkoutUrl: payment?.checkout?.url - }); + console.log(payment); } return { @@ -100,15 +86,6 @@ async function getPayment({ paymentKey, orderId, amount }: PaymentRequestProps) } catch (err: any) { console.log(err); - await axios.patch(`${process.env.NEXT_PUBLIC_API_URL}/api/payments`, { - orderId: orderId, - paymentKey: paymentKey, - amount: amount, - bookingStatus: 'FAILED', - failureCode: err.code, - failureMessage: err.message - }); - return { redirect: { destination: `/payments/fail?code=${err.code}&message=${err.message}&orderId=${orderId}` diff --git a/src/components/common/MobileFooter.tsx b/src/components/common/MobileFooter.tsx index 8776366..3fae215 100644 --- a/src/components/common/MobileFooter.tsx +++ b/src/components/common/MobileFooter.tsx @@ -7,7 +7,7 @@ const MobileFooter = () => { const pathname = usePathname(); return ( -

+
router.push('/')} className="flex-1 flex flex-col gap-1 items-center"> diff --git a/src/components/modal/CouponModal.tsx b/src/components/modal/CouponModal.tsx index 0781166..e833e7c 100644 --- a/src/components/modal/CouponModal.tsx +++ b/src/components/modal/CouponModal.tsx @@ -13,15 +13,11 @@ const Couponmodal = () => { const ref = useRef(null); useOnClickOutside(ref, () => setOpen(false)); - const handleQuit = () => { - //Todo 탈퇴 로직 실행 - }; - return (
+ className=" absolute z-[99999] top-1/2 left-1/2 transform -translate-y-1/2 -translate-x-1/2 ">
diff --git a/src/components/modal/Quitmodal.tsx b/src/components/modal/Quitmodal.tsx index 53b175c..7e53f4f 100644 --- a/src/components/modal/Quitmodal.tsx +++ b/src/components/modal/Quitmodal.tsx @@ -21,7 +21,7 @@ const Quitmodal = () => {
+ className=" absolute z-[99999] top-1/2 left-1/2 transform -translate-y-1/2 -translate-x-1/2 ">
diff --git a/src/components/payment/PaymentCheckIndex.tsx b/src/components/payment/PaymentCheckIndex.tsx index f87aa3e..350ad95 100644 --- a/src/components/payment/PaymentCheckIndex.tsx +++ b/src/components/payment/PaymentCheckIndex.tsx @@ -25,7 +25,7 @@ const PaymentCheckIndex = () => { }; return ( -
+
{/* 뒤로가기 */}
router.back()} className="py-[14px] cursor-pointer max-w-max"> diff --git a/src/components/payment/PaymentIndex.tsx b/src/components/payment/PaymentIndex.tsx index 6eab55a..a10f482 100644 --- a/src/components/payment/PaymentIndex.tsx +++ b/src/components/payment/PaymentIndex.tsx @@ -10,7 +10,7 @@ const PaymentIndex = () => { useEffect(() => { const checkLoginStatus = () => { const token = localStorage.getItem('access_token'); - setIsLoggedIn(!!token); // 로그인 상태를 설정 + setIsLoggedIn(!!token); }; checkLoginStatus(); @@ -25,7 +25,7 @@ const PaymentIndex = () => { }; return ( -
+
{/* 뒤로가기 */}
router.back()} className="py-[14px] cursor-pointer max-w-max"> From 5420093a8bce4bbc6a5db13dd8df6d508e1ec18b Mon Sep 17 00:00:00 2001 From: hojin Date: Tue, 10 Sep 2024 17:31:19 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EB=A6=B0=ED=8A=B8=EC=98=A4=EB=A5=98?= =?UTF-8?q?=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/search/SearchIndex.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/search/SearchIndex.tsx b/src/components/search/SearchIndex.tsx index 36da6fb..2530a7f 100644 --- a/src/components/search/SearchIndex.tsx +++ b/src/components/search/SearchIndex.tsx @@ -31,7 +31,7 @@ const SearchIndex = () => { useEffect(() => { setKeyword(''); - }, []); + }, [setKeyword]); return (