From 50d5ba3cf0536764d60f3eb11591af3dc2f2b0c8 Mon Sep 17 00:00:00 2001 From: seungsimdang Date: Mon, 29 Jan 2024 01:00:26 +0900 Subject: [PATCH 1/4] =?UTF-8?q?Fix:=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20?= =?UTF-8?q?=ED=86=A0=EC=8A=A4=ED=8E=98=EC=9D=B4=20=EA=B2=B0=EC=A0=9C?= =?UTF-8?q?=EC=8B=9C=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/myPage/hooks/usePurchaseHistory2.ts | 7 +- src/pages/purchase/reservationComplete.tsx | 76 ++++++++++--------- vite.config.ts | 4 +- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/src/pages/myPage/hooks/usePurchaseHistory2.ts b/src/pages/myPage/hooks/usePurchaseHistory2.ts index 293dd6da..9aeb7a4e 100644 --- a/src/pages/myPage/hooks/usePurchaseHistory2.ts +++ b/src/pages/myPage/hooks/usePurchaseHistory2.ts @@ -1,10 +1,11 @@ -import { useSuspenseQuery } from "@tanstack/react-query"; +import { useQuery } from "@tanstack/react-query"; import getPurchaseHistory2 from "../apis/getPurchaseHistory2"; const usePurchaseHistory2 = () => { - return useSuspenseQuery({ + return useQuery({ queryKey: ["purchaseHistory2"], - queryFn: () => getPurchaseHistory2() + queryFn: () => getPurchaseHistory2(), + enabled: false }); }; diff --git a/src/pages/purchase/reservationComplete.tsx b/src/pages/purchase/reservationComplete.tsx index 855a9ab0..653c7e6d 100644 --- a/src/pages/purchase/reservationComplete.tsx +++ b/src/pages/purchase/reservationComplete.tsx @@ -35,11 +35,9 @@ const ReservationComplete = () => { const { productId, isMobile } = purchaseInfo; - console.log("purchaseInfo", purchaseInfo); + const { data, error, refetch, isSuccess } = usePurchaseHistory2(); - const { data, error } = usePurchaseHistory2(); - - const [filteredTrades, setFilteredTrades] = useState(); + const [filteredTrades, setFilteredTrades] = useState([]); if (error) { console.log(error); @@ -50,15 +48,9 @@ const ReservationComplete = () => { }, []); useEffect(() => { - if (!isMobile) { - setFilteredTrades( - data?.purchaseTrades?.filter((trade: TradeData) => trade?.productId === Number(productId)) - ); - } - }, [data]); + console.log("isMobile", isMobile); - useEffect(() => { - if (isMobile) { + if (isMobile === "true") { buyProductMutate({ productId: Number(purchaseInfo?.productId), reservationPersonName: purchaseInfo?.reservationPersonName as string, @@ -68,18 +60,24 @@ const ReservationComplete = () => { point: Number(purchaseInfo.point), paymentType: purchaseInfo.paymentType as string }); + } else { + refetch(); } }, []); useEffect(() => { if (buyProductSuccess) { + refetch(); + } + }, [buyProductSuccess]); + + useEffect(() => { + if (isSuccess) { setFilteredTrades( data?.purchaseTrades?.filter((trade: TradeData) => trade?.productId === Number(productId)) ); } - }, [buyProductSuccess]); - - console.log("filteredTrades", filteredTrades); + }, [isSuccess]); return ( @@ -142,28 +140,32 @@ const ReservationComplete = () => { - 거래 정보 - - - - - 주문번호 - {filteredTrades[0]?.tradeId} - - - 판매자 - {filteredTrades[0]?.sellerNickname} - - - 주문일시 - {filteredTrades[0]?.tradeRegisteredTime} - - + {filteredTrades && ( + <> + 거래 정보 + + + + + 주문번호 + {filteredTrades[0]?.tradeId} + + + 판매자 + {filteredTrades[0]?.sellerNickname} + + + 주문일시 + {filteredTrades[0]?.tradeRegisteredTime} + + + + )} 결제 정보 diff --git a/vite.config.ts b/vite.config.ts index c0da54f6..42b99981 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -10,9 +10,11 @@ export default defineConfig({ global: {} }, build: { + minify: "terser", terserOptions: { compress: { - drop_console: true + drop_console: true, + drop_debugger: true } } } From e694c96d18726f910d45c5fbef755f2f5e932df2 Mon Sep 17 00:00:00 2001 From: seungsimdang Date: Mon, 29 Jan 2024 01:07:49 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Fix:=20=EC=A7=80=EB=B6=88=20=EC=88=98?= =?UTF-8?q?=EB=8B=A8=20=ED=95=9C=EA=B5=AD=EC=96=B4=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/purchase/reservationComplete.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/purchase/reservationComplete.tsx b/src/pages/purchase/reservationComplete.tsx index 653c7e6d..8564fb3b 100644 --- a/src/pages/purchase/reservationComplete.tsx +++ b/src/pages/purchase/reservationComplete.tsx @@ -12,6 +12,7 @@ import { useLocation } from "react-router-dom"; import queryString from "query-string"; import formatNumberWithCommas from "@pages/myPage/utils/formatNumberWithCommas"; import useBuyProduct from "@pages/purchase/hooks/useBuyProduct"; +import { convertStringToKR } from "./utils/convertString"; interface TradeData { tradeId: number; @@ -188,7 +189,7 @@ const ReservationComplete = () => { 결제 수단 - {purchaseInfo?.paymentType} + {convertStringToKR(purchaseInfo?.paymentType)} From 5270110f7157e61d17f72ed5d2bfb9333ba90a5a Mon Sep 17 00:00:00 2001 From: seungsimdang Date: Mon, 29 Jan 2024 01:08:29 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Fix:=20=ED=83=80=EC=9E=85=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/purchase/reservationComplete.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/purchase/reservationComplete.tsx b/src/pages/purchase/reservationComplete.tsx index 8564fb3b..8291e356 100644 --- a/src/pages/purchase/reservationComplete.tsx +++ b/src/pages/purchase/reservationComplete.tsx @@ -189,7 +189,7 @@ const ReservationComplete = () => { 결제 수단 - {convertStringToKR(purchaseInfo?.paymentType)} + {convertStringToKR(purchaseInfo?.paymentType as string)} From 4b9b6205475e89caef657d7c9fc52f65e9cd1660 Mon Sep 17 00:00:00 2001 From: wkdtnqls0506 Date: Mon, 29 Jan 2024 12:26:26 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Fix:=20=EB=A6=AC=EC=95=A1=ED=8A=B8=20?= =?UTF-8?q?=ED=9B=85=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/speicialProducts/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/speicialProducts/index.tsx b/src/pages/speicialProducts/index.tsx index 1509d887..85b78d6c 100644 --- a/src/pages/speicialProducts/index.tsx +++ b/src/pages/speicialProducts/index.tsx @@ -1,6 +1,6 @@ import UpperNavBar from "@components/navBar/upperNavBar"; import useProducts from "@pages/products/api/queries"; -import Order from "@pages/products/components/Order"; +// import Order from "@pages/products/components/Order"; import ProductCard from "@pages/products/components/ProductCard"; import logo from "@assets/2024_dragon.png"; import { ScrollRestoration } from "react-router-dom"; @@ -22,7 +22,7 @@ const SpecialProducts = () => {

2024년을 시작하는 신년 파티룸

- + {/* */} {products.map((product) => ( ))}