[common/components] chore: 로그인 연장 콘솔 추가(임시)

This commit is contained in:
2026-07-21 11:47:39 +09:00
parent d26cd90b02
commit 3e1f89d90f
2 changed files with 16 additions and 2 deletions
@@ -15,6 +15,14 @@ interface UseSessionExtendConfirmOptions {
const DEFAULT_MESSAGE = "로그인을 연장하시겠습니까?";
function formatRemainingMs(remainingMs: number): string {
const totalSeconds = Math.floor(remainingMs / 1000);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
return `${minutes}분 ${seconds}초`;
}
function useSessionExtendConfirm({
enabled,
getAccessToken,
@@ -71,8 +79,10 @@ function useSessionExtendConfirm({
void showConfirm();
return;
}
confirmTimerRef.current = setTimeout(() => {
console.log(
`>>>>>>>>>>>>>>>>>>>> ${formatRemainingMs(confirmMs)} 후 로그인 연장 팝업 표시 <<<<<<<<<<<<<<<<<<<<`,
);
void showConfirm();
}, confirmMs);
}, [message, confirm, getAccessToken, silentRefresh, declineSessionExtend]);
@@ -117,7 +117,7 @@ function useTokenRemainingMs(enabled: boolean): number {
const update = () => {
const token = getCookie(appConfig.CLAIM_NAME ?? "");
setRemainingMs(token ? getRemainingMs(token) : 0);
setRemainingMs(token ? getRemainingMs(token, 0) : 0);
};
update();
@@ -145,6 +145,10 @@ export function Header({
const remainingMs = useTokenRemainingMs(mounted && isLoggedIn && !viewOnly);
const siteId = getCookie("site-id-key") ?? "";
console.log(
`/********************* 로그인 만료까지: ${formatRemainingMs(remainingMs)} *********************/`,
);
useSessionExtendConfirm({
enabled:
mounted &&