From c1dd63096ec5273cd7eafc590db8f6f1c0aa2805 Mon Sep 17 00:00:00 2001 From: wonjin-dev Date: Wed, 10 Jan 2024 22:06:58 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/http.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/api/http.ts b/src/api/http.ts index 310bc944..e559c9e4 100644 --- a/src/api/http.ts +++ b/src/api/http.ts @@ -6,10 +6,10 @@ const instance = axios.create({ headers: { 'content-type': 'application/json' }, }); -type BaroError = { +interface BaroErrorType { status?: number; message?: string; -}; +} instance.interceptors.response.use( (response: AxiosResponse) => { @@ -18,7 +18,7 @@ instance.interceptors.response.use( (error: AxiosError) => { // Network Error 발생 캐치 if (!error.response) { - return Promise.reject({ + return Promise.reject({ status: 408, message: '현재 네트워크 상태가 불안정합니다. 잠시후 다시 시도해주세요', }); @@ -26,10 +26,13 @@ instance.interceptors.response.use( // 서버 에러 캐치 if (error.status > 500) { - return Promise.reject({ status: error.status, message: '' }); + return Promise.reject({ + status: error.status, + message: '', + }); } - return Promise.reject(error); + return Promise.reject(error); }, );