From 60b2fd1b8d68e798b61e8e34d9c4bd9b7cd30d7b Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Mon, 30 Mar 2026 13:38:01 +0900 Subject: [PATCH] =?UTF-8?q?fix(dashboard):=20api()=20=ED=97=AC=ED=8D=BC=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9C=BC=EB=A1=9C=20=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 직접 fetch() + 수동 토큰 조합 대신 tkfb-core.js의 api() 헬퍼 사용. 불필요한 getCookie() 함수 제거. Co-Authored-By: Claude Opus 4.6 (1M context) --- system1-factory/web/js/production-dashboard.js | 13 +------------ system1-factory/web/pages/dashboard-new.html | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/system1-factory/web/js/production-dashboard.js b/system1-factory/web/js/production-dashboard.js index 58ae99f..a7163b8 100644 --- a/system1-factory/web/js/production-dashboard.js +++ b/system1-factory/web/js/production-dashboard.js @@ -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; diff --git a/system1-factory/web/pages/dashboard-new.html b/system1-factory/web/pages/dashboard-new.html index d8952b9..c85622c 100644 --- a/system1-factory/web/pages/dashboard-new.html +++ b/system1-factory/web/pages/dashboard-new.html @@ -34,6 +34,6 @@ - +