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); }, );