From e9d78e48a78bca3e6cd166eb2efa78f156d2e674 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Mon, 3 Nov 2025 11:59:06 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8A=A4=ED=81=AC=EB=A6=BD=ED=8A=B8=20?= =?UTF-8?q?=EB=A1=9C=EB=94=A9=20=EC=88=9C=EC=84=9C=20=EB=B0=8F=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ› ํ•ด๊ฒฐ๋œ ๋ฌธ์ œ: - auth-check.js์˜ ES6 import ๋ฌธ๋ฒ• ์˜ค๋ฅ˜ - window.apiCall is not a function ์˜ค๋ฅ˜ - ์Šคํฌ๋ฆฝํŠธ ๋กœ๋”ฉ ์ˆœ์„œ๋กœ ์ธํ•œ ์˜์กด์„ฑ ๋ฌธ์ œ ๐Ÿ”ง ์ˆ˜์ • ๋‚ด์šฉ: 1. auth-check.js: - ES6 import ์ œ๊ฑฐ โ†’ ํ•จ์ˆ˜ ์ง์ ‘ ๊ตฌํ˜„ - isLoggedIn, getUser, clearAuthData ๋‚ด์žฅ - ๋ชจ๋“ˆ ์˜์กด์„ฑ ์™„์ „ ์ œ๊ฑฐ 2. ์Šคํฌ๋ฆฝํŠธ ๋กœ๋”ฉ ์ˆœ์„œ ์ตœ์ ํ™”: - api-config.js: defer ์ œ๊ฑฐ (์ฆ‰์‹œ ๋กœ๋“œ) - auth-check.js: defer ์œ ์ง€ - modern-dashboard.js: defer ์œ ์ง€ 3. modern-dashboard.js: - API ํ•จ์ˆ˜ ๋กœ๋“œ ๋Œ€๊ธฐ ๋กœ์ง ์ถ”๊ฐ€ - ์ตœ๋Œ€ 5์ดˆ ๋Œ€๊ธฐ ํ›„ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ - ์•ˆ์ „ํ•œ ์ดˆ๊ธฐํ™” ๋ณด์žฅ โœ… ๊ฐœ์„  ํšจ๊ณผ: - ๋ชจ๋“  JavaScript ์˜ค๋ฅ˜ ํ•ด๊ฒฐ - ์•ˆ์ •์ ์ธ ์Šคํฌ๋ฆฝํŠธ ๋กœ๋”ฉ ์ˆœ์„œ - API ํ•จ์ˆ˜ ์˜์กด์„ฑ ๋ฌธ์ œ ํ•ด๊ฒฐ - ๋Œ€์‹œ๋ณด๋“œ ์ •์ƒ ์ดˆ๊ธฐํ™” ๋ณด์žฅ ํ…Œ์ŠคํŠธ: http://localhost:20000/pages/dashboard/group-leader.html --- web-ui/js/auth-check.js | 17 ++++++++++++++++- web-ui/js/modern-dashboard.js | 15 +++++++++++++++ web-ui/pages/dashboard/group-leader.html | 5 +++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/web-ui/js/auth-check.js b/web-ui/js/auth-check.js index d43e51a..0f243be 100644 --- a/web-ui/js/auth-check.js +++ b/web-ui/js/auth-check.js @@ -1,5 +1,20 @@ // /js/auth-check.js -import { isLoggedIn, getUser, clearAuthData } from './auth.js'; +// auth.js์˜ ํ•จ์ˆ˜๋“ค์„ ์ง์ ‘ ๊ตฌํ˜„ (๋ชจ๋“ˆ ์˜์กด์„ฑ ์ œ๊ฑฐ) + +function isLoggedIn() { + const token = localStorage.getItem('token'); + return token && token !== 'undefined' && token !== 'null'; +} + +function getUser() { + const user = localStorage.getItem('user'); + return user ? JSON.parse(user) : null; +} + +function clearAuthData() { + localStorage.removeItem('token'); + localStorage.removeItem('user'); +} // ์ฆ‰์‹œ ์‹คํ–‰ ํ•จ์ˆ˜๋กœ ์Šค์ฝ”ํ”„๋ฅผ ๋ณดํ˜ธํ•˜๊ณ  ๋กœ์ง์„ ์‹คํ–‰ (function() { diff --git a/web-ui/js/modern-dashboard.js b/web-ui/js/modern-dashboard.js index c421f54..5ffba6c 100644 --- a/web-ui/js/modern-dashboard.js +++ b/web-ui/js/modern-dashboard.js @@ -44,6 +44,21 @@ const elements = { // ========== ์ดˆ๊ธฐํ™” ========== // document.addEventListener('DOMContentLoaded', async () => { + // API ํ•จ์ˆ˜๊ฐ€ ๋กœ๋“œ๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆผ + let retryCount = 0; + const maxRetries = 50; // 5์ดˆ ๋Œ€๊ธฐ + + while (!window.apiCall && retryCount < maxRetries) { + await new Promise(resolve => setTimeout(resolve, 100)); + retryCount++; + } + + if (!window.apiCall) { + console.error('โŒ API ํ•จ์ˆ˜๋ฅผ ๋กœ๋“œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.'); + showToast('์‹œ์Šคํ…œ์„ ์ดˆ๊ธฐํ™”ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ํŽ˜์ด์ง€๋ฅผ ์ƒˆ๋กœ๊ณ ์นจํ•ด์ฃผ์„ธ์š”.', 'error'); + return; + } + try { await initializeDashboard(); } catch (error) { diff --git a/web-ui/pages/dashboard/group-leader.html b/web-ui/pages/dashboard/group-leader.html index 2be714c..1dfe655 100644 --- a/web-ui/pages/dashboard/group-leader.html +++ b/web-ui/pages/dashboard/group-leader.html @@ -10,9 +10,10 @@ - + + - +