From ad44abbb0c239c384d58d153d0502dac3e995df0 Mon Sep 17 00:00:00 2001 From: hojeong26 Date: Mon, 25 Nov 2024 00:44:50 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=B5=9C=EC=A2=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/hooks/useConfirmPayment.ts | 2 +- src/api/instance/index.ts | 2 +- src/components/OrderHistory/OrderListItem.tsx | 7 +--- src/components/common/MyPoint/index.tsx | 38 ++++++++----------- src/components/mypage/Profile.tsx | 1 + src/pages/LoginPage/index.tsx | 6 +-- src/pages/SignupPage/index.tsx | 3 ++ 7 files changed, 25 insertions(+), 34 deletions(-) diff --git a/src/api/hooks/useConfirmPayment.ts b/src/api/hooks/useConfirmPayment.ts index afc4c52..c3eaa0b 100644 --- a/src/api/hooks/useConfirmPayment.ts +++ b/src/api/hooks/useConfirmPayment.ts @@ -24,7 +24,7 @@ const confirmPayment = async ({ } const response = await axios.post( - 'https://order-together.duckdns.org/api/v1/payments/confirm', + 'http://3.36.88.170:8080/api/v1/payments/confirm', { orderId, amount, paymentKey }, { headers: { diff --git a/src/api/instance/index.ts b/src/api/instance/index.ts index e521d39..ebf09d7 100644 --- a/src/api/instance/index.ts +++ b/src/api/instance/index.ts @@ -14,7 +14,7 @@ const initInstance = (config: AxiosRequestConfig): AxiosInstance => { return instance; }; -const BASE_URL = 'https://order-together.duckdns.org/api/v1'; +const BASE_URL = 'http://3.36.88.170:8080/api/v1'; export const fetchInstance = initInstance({ baseURL: BASE_URL, diff --git a/src/components/OrderHistory/OrderListItem.tsx b/src/components/OrderHistory/OrderListItem.tsx index c93bc28..14aa97b 100644 --- a/src/components/OrderHistory/OrderListItem.tsx +++ b/src/components/OrderHistory/OrderListItem.tsx @@ -22,11 +22,6 @@ const OrderListItem = ({ -
- 진행중 - {deliveryStatus} -
- [{category}] {storeName} @@ -34,7 +29,7 @@ const OrderListItem = ({ 주문 날짜: {date[0]}-{date[1]}-{date[2]}
픽업장소: {pickUpLocation}
- {price ? `결제금액: ${price}P` : ''} + {price && price !== -1 ? `결제금액: ${price}P` : ''}
diff --git a/src/components/common/MyPoint/index.tsx b/src/components/common/MyPoint/index.tsx index 71c4d48..5fbf49e 100644 --- a/src/components/common/MyPoint/index.tsx +++ b/src/components/common/MyPoint/index.tsx @@ -28,16 +28,13 @@ const MyPoint: React.FC = ({ const accessToken = Cookies.get('access_token'); if (!accessToken) return; - const response = await fetch( - 'https://order-together.duckdns.org/api/v1/members', - { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, + const response = await fetch('http://3.36.88.170:8080/api/v1/members', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${accessToken}`, }, - ); + }); if (response.ok) { const data = await response.json(); @@ -84,20 +81,17 @@ const MyPoint: React.FC = ({ } try { - const response = await fetch( - 'https://order-together.duckdns.org/api/v1/payments', - { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - body: JSON.stringify({ - idempotencySeed: Math.random().toString(36).substr(2, 10), - productIds, - }), + const response = await fetch('http://3.36.88.170:8080/api/v1/payments', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${accessToken}`, }, - ); + body: JSON.stringify({ + idempotencySeed: Math.random().toString(36).substr(2, 10), + productIds, + }), + }); if (!response.ok) { throw new Error('결제 정보 저장 실패'); diff --git a/src/components/mypage/Profile.tsx b/src/components/mypage/Profile.tsx index b3454b5..037e0f0 100644 --- a/src/components/mypage/Profile.tsx +++ b/src/components/mypage/Profile.tsx @@ -29,6 +29,7 @@ const Profile = ({ editMode, name, phoneNumber }: Props) => { .then((response) => { if (response.status === 200 && response.data) { Cookies.remove('access_token'); + sessionStorage.removeItem('codeProcessed'); setIsLoggedIn(false); navigate(RouterPath.introduce); } diff --git a/src/pages/LoginPage/index.tsx b/src/pages/LoginPage/index.tsx index ebf07f6..a73496a 100644 --- a/src/pages/LoginPage/index.tsx +++ b/src/pages/LoginPage/index.tsx @@ -41,12 +41,9 @@ const LoginPage: React.FC = () => { Authorization: `Bearer ${code}`, 'Content-Type': 'application/json', }, - maxRedirects: 0, }) .then((response) => { - if (response.status === 302) { - window.location.href = response.data.redirectURL; - } + console.log('호출'); const accessToken = response.data.data.token; if (accessToken) { Cookies.set('access_token', accessToken); @@ -57,6 +54,7 @@ const LoginPage: React.FC = () => { } }) .catch((error) => { + console.log('login: ', error); if (error.response) { if (error.response.status === 404) { const redirectUrl = error.request.responseURL; diff --git a/src/pages/SignupPage/index.tsx b/src/pages/SignupPage/index.tsx index 0a9199e..c811e27 100644 --- a/src/pages/SignupPage/index.tsx +++ b/src/pages/SignupPage/index.tsx @@ -53,6 +53,9 @@ const SignupPage: React.FC = () => { navigate(RouterPath.root); navigate(0); } + }) + .catch((error) => { + console.log('signup:', error); }); };