fix(dashboard): api() 헬퍼 사용으로 인증 오류 해결

직접 fetch() + 수동 토큰 조합 대신 tkfb-core.js의 api() 헬퍼 사용.
불필요한 getCookie() 함수 제거.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-30 13:38:01 +09:00
parent 1fd6253fbc
commit 60b2fd1b8d
2 changed files with 2 additions and 13 deletions

View File

@@ -48,13 +48,7 @@ function escHtml(s) { const d = document.createElement('div'); d.textContent = s
async function initDashboard() {
showSkeleton();
try {
const token = typeof getToken === 'function' ? getToken() : (localStorage.getItem('sso_token') || getCookie('sso_token'));
if (!token) { showError('로그인이 필요합니다.'); return; }
const resp = await fetch('/api/dashboard/my-summary', {
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' }
});
if (!resp.ok) throw new Error('API 오류: ' + resp.status);
const result = await resp.json();
const result = await api('/dashboard/my-summary');
if (!result.success) throw new Error(result.message || '데이터 로드 실패');
renderDashboard(result.data);
} catch (err) {
@@ -62,11 +56,6 @@ async function initDashboard() {
}
}
function getCookie(name) {
const v = document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)');
return v ? v.pop() : '';
}
function renderDashboard(data) {
const { user, vacation, overtime, quick_access } = data;

View File

@@ -34,6 +34,6 @@
</main>
<script src="/static/js/tkfb-core.js?v=2026033002"></script>
<script src="/js/production-dashboard.js?v=2026033001"></script>
<script src="/js/production-dashboard.js?v=2026033002"></script>
</body>
</html>