fix(tkfb): 내 연차 정보 페이지 인증 수정 — 쿠키 우선 읽기

axios 토큰과 사용자 정보를 localStorage에서만 읽어서
쿠키 기반 인증 시 API 호출이 안 되던 문제.
getSSOToken()/getSSOUser() 사용하여 쿠키 우선으로 전환.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-31 07:53:16 +09:00
parent 5dee4fd600
commit 71ef40c26c

View File

@@ -275,7 +275,7 @@
if (window.API_BASE_URL) {
clearInterval(check);
axios.defaults.baseURL = window.API_BASE_URL;
const token = localStorage.getItem('sso_token');
const token = window.getSSOToken ? window.getSSOToken() : (localStorage.getItem('sso_token'));
if (token) axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
}
}, 50);
@@ -303,14 +303,11 @@
}
async function initPage() {
// 현재 사용자 정보 가져오기
const userStr = localStorage.getItem('sso_user');
if (userStr) {
try {
currentUser = JSON.parse(userStr);
} catch (e) {
console.error('사용자 정보 파싱 실패');
}
// 현재 사용자 정보 가져오기 (쿠키 우선, localStorage 폴백)
currentUser = window.getSSOUser ? window.getSSOUser() : null;
if (!currentUser) {
const userStr = localStorage.getItem('sso_user');
if (userStr) { try { currentUser = JSON.parse(userStr); } catch(e) {} }
}
// 관리자 여부 확인