[251209] fix: 백화현상 디버깅-1
🕐 커밋 시간: 2025. 12. 09. 18:18:51 📊 변경 통계: • 총 파일: 2개 • 추가: +28줄 • 삭제: -4줄 📝 수정된 파일: ~ com.twin.app.shoptime/src/actions/homeActions.js ~ com.twin.app.shoptime/src/api/TAxios.js 🔧 주요 변경 내용: • 핵심 비즈니스 로직 개선 • API 서비스 레이어 개선 • 소규모 기능 개선
This commit is contained in:
@@ -4,6 +4,8 @@ import { types } from './actionTypes';
|
|||||||
import { changeAppStatus, getTermsAgreeYn } from './commonActions';
|
import { changeAppStatus, getTermsAgreeYn } from './commonActions';
|
||||||
import { collectBannerPositions } from '../utils/domUtils';
|
import { collectBannerPositions } from '../utils/domUtils';
|
||||||
import { createDebugHelpers } from '../utils/debug';
|
import { createDebugHelpers } from '../utils/debug';
|
||||||
|
import { setHidePopup, setShowPopup } from './commonActions';
|
||||||
|
import { ACTIVE_POPUP } from '../utils/Config';
|
||||||
|
|
||||||
// 디버그 헬퍼 설정
|
// 디버그 헬퍼 설정
|
||||||
const DEBUG_MODE = false;
|
const DEBUG_MODE = false;
|
||||||
@@ -76,9 +78,18 @@ export const getHomeTerms = (props) => (dispatch, getState) => {
|
|||||||
const onFail = (error) => {
|
const onFail = (error) => {
|
||||||
derror('getHomeTerms onFail ', error);
|
derror('getHomeTerms onFail ', error);
|
||||||
|
|
||||||
|
// TODO: 임시 디버그용 팝업 (재현 후 제거하세요)
|
||||||
|
const retCode = error?.data?.retCode ?? error?.retCode ?? 'unknown';
|
||||||
|
dispatch(
|
||||||
|
setShowPopup(ACTIVE_POPUP.toast, {
|
||||||
|
button1Text: `getHomeTerms onFail retCode=${retCode}`,
|
||||||
|
button2Text: 'OK',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
setTimeout(() => dispatch(setHidePopup()), 1500);
|
||||||
|
|
||||||
// 약관 미동의(retCode 501)로 GET_HOME_TERMS가 실패하면
|
// 약관 미동의(retCode 501)로 GET_HOME_TERMS가 실패하면
|
||||||
// introTermsAgree를 명시적으로 false로 내려 앱이 IntroPanel을 띄우도록 한다.
|
// introTermsAgree를 명시적으로 false로 내려 앱이 IntroPanel을 띄우도록 한다.
|
||||||
const retCode = error?.data?.retCode ?? error?.retCode;
|
|
||||||
if (retCode === 501) {
|
if (retCode === 501) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.GET_TERMS_AGREE_YN_SUCCESS,
|
type: types.GET_TERMS_AGREE_YN_SUCCESS,
|
||||||
@@ -91,6 +102,13 @@ export const getHomeTerms = (props) => (dispatch, getState) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 실패 시 로딩 패널을 반드시 내려 백화 상태를 방지
|
||||||
|
dispatch(
|
||||||
|
changeAppStatus({
|
||||||
|
showLoadingPanel: { show: false },
|
||||||
|
})
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
TAxios(
|
TAxios(
|
||||||
|
|||||||
@@ -185,8 +185,14 @@ export const TAxios = (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 약관 미동의(501): 토큰 재발급 큐에 넣지 않고 바로 실패 처리
|
||||||
|
if (res?.data?.retCode === 501) {
|
||||||
|
if (onFail) onFail(res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// RefreshToken 만료
|
// RefreshToken 만료
|
||||||
if (res?.data?.retCode === 402 || res?.data?.retCode === 501) {
|
if (res?.data?.retCode === 402) {
|
||||||
if (baseUrl === URLS.GET_RE_AUTHENTICATION_CODE) {
|
if (baseUrl === URLS.GET_RE_AUTHENTICATION_CODE) {
|
||||||
dispatch(getAuthenticationCode());
|
dispatch(getAuthenticationCode());
|
||||||
} else {
|
} else {
|
||||||
@@ -349,10 +355,10 @@ export const TAxiosAdvancedPromise = (
|
|||||||
console.error(`TAxiosPromise error on attempt ${attempts} for ${baseUrl}:`, error);
|
console.error(`TAxiosPromise error on attempt ${attempts} for ${baseUrl}:`, error);
|
||||||
|
|
||||||
// Check if the error is due to token expiration
|
// Check if the error is due to token expiration
|
||||||
// TAxios already handles token refresh and queueing for these codes (401, 402, 501)
|
// TAxios already handles token refresh and queueing for 401/402 (501은 제외)
|
||||||
// So we should NOT retry immediately in this loop, but let TAxios handle it.
|
// So we should NOT retry immediately in this loop, but let TAxios handle it.
|
||||||
const retCode = error?.data?.retCode;
|
const retCode = error?.data?.retCode;
|
||||||
const isTokenError = retCode === 401 || retCode === 402 || retCode === 501;
|
const isTokenError = retCode === 401 || retCode === 402;
|
||||||
|
|
||||||
// 재시도 로직
|
// 재시도 로직
|
||||||
if (attempts < maxAttempts && !isTokenError) {
|
if (attempts < maxAttempts && !isTokenError) {
|
||||||
|
|||||||
Reference in New Issue
Block a user