Skip to content

Commit 9d97e5c

Browse files
committed
fix: 결제 관련 API 요청 파라미터를 pgOrderId로 수정
1 parent 5c9a23a commit 9d97e5c

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/pages/payment/Purchase.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ const Purchase = () => {
254254

255255
const orderRes = await api.post("/order/item", requestBody);
256256

257-
const orderId = orderRes.data?.orderId;
257+
const orderId = orderRes.data?.pgOrderId;
258258

259259
if (!orderId) {
260260
alert(orderRes.data?.error ?? "주문 생성 실패");

src/pages/payment/PurchaseSuccess.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import useWindowDimensions from "@/hooks/useWindowDimensions";
1616
const PurchaseSuccess = () => {
1717
const navigate = useNavigate();
1818
const location = useLocation();
19-
const stateOrderId = location.state?.orderId;
19+
const statePgOrderId = location.state?.pgOrderId;
2020

2121
const queryParams = new URLSearchParams(location.search);
22-
const queryOrderId = queryParams.get("orderId");
23-
const orderId = stateOrderId || queryOrderId;
22+
const queryPgOrderId = queryParams.get("pgOrderId");
23+
const pgOrderId = statePgOrderId || queryPgOrderId;
2424

2525
const [orderDate, setOrderDate] = useState("");
2626
const [scriptTitle, setScriptTitle] = useState("");
@@ -38,7 +38,7 @@ const PurchaseSuccess = () => {
3838
try {
3939
const response = await api.get(`/order/success`, {
4040
params: {
41-
orderId,
41+
pgOrderId,
4242
},
4343
});
4444

@@ -60,8 +60,8 @@ const PurchaseSuccess = () => {
6060
return <Loading />;
6161
}
6262

63-
if (!orderId) {
64-
// orderId가 정말 없으면 에러 처리 가능
63+
if (!pgOrderId) {
64+
// pgOrderId 정말 없으면 에러 처리 가능
6565
return <div>잘못된 접근입니다.</div>;
6666
}
6767
return (
@@ -73,7 +73,7 @@ const PurchaseSuccess = () => {
7373
<p>&nbsp;{formattedOrderDate}</p>
7474
<div className="order-num">
7575
<p>주문 번호</p>
76-
<p>{orderId}</p>
76+
<p>{pgOrderId}</p>
7777
</div>
7878
</div>
7979
<div className="w-[280px] sm:w-[414px]">

0 commit comments

Comments
 (0)