Skip to content

Commit 5993469

Browse files
authored
fix: 구매하기 item api에 tid 바디 추가 (#393)
* fix: 작품 등록하기 api 중복 호출 제거 * fix: 구매하기 item api에 tid 바디 추가 * Revert "fix: 구매하기 item api에 tid 바디 추가" This reverts commit 12ebf99. * fix: 구매하기 item api에 tid 바디 추가
1 parent 1dba5a8 commit 5993469

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/pages/payment/PurchaseRedirect.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ const PurchaseRedirect = () => {
1313
try {
1414
// 1) 나이스페이가 붙여준 파라미터 확인 (이름은 실제로 찍어보면서 맞추면 돼)
1515
const params = new URLSearchParams(location.search);
16-
console.log(params);
16+
console.log("나이스페이 ", params);
17+
18+
const tid = params.get("tid") || params.get("Tid") || params.get("TID");
19+
20+
console.log("받은 tid:", tid);
21+
1722
const resultCode = params.get("ResultCode") || params.get("resultCode");
1823

1924
// 실패거나 코드 못 읽으면 실패로 처리
@@ -26,23 +31,28 @@ const PurchaseRedirect = () => {
2631
const saved = sessionStorage.getItem("podo_payment_request");
2732
if (!saved) {
2833
// 정보가 없으면 안전하게 실패 처리
29-
navigate("/purchase/abort");
34+
navigate("/purchase/abort");
3035
return;
3136
}
3237

3338
const requestBody = JSON.parse(saved);
39+
const finalBody = {
40+
...requestBody,
41+
tid,
42+
};
3443

3544
// 3) 원래 fnSuccess 안에서 하던 주문 생성 API 호출
3645
const response = await axios.post(
3746
`${SERVER_URL}order/item`,
38-
requestBody,
47+
finalBody,
3948
{
4049
headers: {
4150
"Content-Type": "application/json",
4251
Authorization: `Bearer ${Cookies.get("accessToken")}`,
4352
},
4453
}
4554
);
55+
console.log("주문 생성 응답:", response.data);
4656
const orderData = response.data[0];
4757

4858
// 사용한 정보 제거

0 commit comments

Comments
 (0)