From f9160f9bd1437b76f999d145c29b66dc7a2d8bc2 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Sat, 25 Oct 2025 12:32:33 +0900 Subject: [PATCH] =?UTF-8?q?debug:=20AuthManager=20=EB=B0=8F=20DOM=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EB=94=94=EB=B2=84=EA=B9=85=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ” Debug Logs Added: - AuthManager.checkAuth() 상세 μƒνƒœ 둜그 - localStorage 토큰/μ‚¬μš©μž 정보 쑴재 μ—¬λΆ€ 확인 - currentUser μ „μ—­ λ³€μˆ˜ μ—…λ°μ΄νŠΈ 둜그 - DOM μš”μ†Œ 쑴재 μ—¬λΆ€ 및 ν™”λ©΄ μ „ν™˜ μƒνƒœ 확인 🎯 Issue Analysis: - AuthManager 정상 μž‘λ™ 확인됨 (βœ… μΊμ‹œλœ 인증 정보 μ‚¬μš©) - 곡톡 헀더 μ΄ˆκΈ°ν™” 성곡 - currentUser undefined 문제 β†’ μ „μ—­ λ³€μˆ˜ 동기화 이슈 - 둜그인 μ°½ λ³΄μž„ β†’ DOM μ‘°μž‘ μ‹€νŒ¨ κ°€λŠ₯μ„± πŸ”§ Enhanced Debugging: - πŸ–₯️ ν™”λ©΄ μ „ν™˜ μ‹œμž‘/μ™„λ£Œ 둜그 - loginScreen/mainScreen μš”μ†Œ 쑴재 확인 - CSS 클래슀 적용 μƒνƒœ 확인 - ν™”λ©΄ μ „ν™˜ μ‹€νŒ¨ μ‹œ μ—λŸ¬ 둜그 Next Step: μ½˜μ†” 둜그 ν™•μΈν•˜μ—¬ μ •ν™•ν•œ μ‹€νŒ¨ 지점 νŒŒμ•… --- frontend/index.html | 19 +++++++++++++++++-- frontend/static/js/core/auth-manager.js | 13 +++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 03480f4..b368eaa 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -555,6 +555,7 @@ if (user) { currentUser = user; + console.log('βœ… currentUser μ „μ—­ λ³€μˆ˜ μ—…λ°μ΄νŠΈ:', currentUser.username); // 곡톡 헀더 μ΄ˆκΈ°ν™” console.log('πŸ”§ 곡톡 헀더 μ΄ˆκΈ°ν™” μ‹œμž‘:', user.username); @@ -582,8 +583,22 @@ }, 500); // 메인 ν™”λ©΄ ν‘œμ‹œ - document.getElementById('loginScreen').classList.add('hidden'); - document.getElementById('mainScreen').classList.remove('hidden'); + console.log('πŸ–₯️ ν™”λ©΄ μ „ν™˜ μ‹œμž‘'); + const loginScreen = document.getElementById('loginScreen'); + const mainScreen = document.getElementById('mainScreen'); + + console.log('loginScreen μš”μ†Œ:', !!loginScreen); + console.log('mainScreen μš”μ†Œ:', !!mainScreen); + + if (loginScreen && mainScreen) { + loginScreen.classList.add('hidden'); + mainScreen.classList.remove('hidden'); + console.log('βœ… 메인 ν™”λ©΄μœΌλ‘œ μ „ν™˜ μ™„λ£Œ'); + console.log('loginScreen hidden:', loginScreen.classList.contains('hidden')); + console.log('mainScreen hidden:', mainScreen.classList.contains('hidden')); + } else { + console.error('❌ ν™”λ©΄ μš”μ†Œλ₯Ό 찾을 수 μ—†μŒ'); + } // 데이터 λ‘œλ“œ await loadProjects(); diff --git a/frontend/static/js/core/auth-manager.js b/frontend/static/js/core/auth-manager.js index 2c3c079..93c89cc 100644 --- a/frontend/static/js/core/auth-manager.js +++ b/frontend/static/js/core/auth-manager.js @@ -41,6 +41,10 @@ class AuthManager { const token = localStorage.getItem('access_token'); const userStr = localStorage.getItem('currentUser'); + console.log('πŸ” localStorage 확인:'); + console.log('- 토큰 쑴재:', !!token); + console.log('- μ‚¬μš©μž 정보 쑴재:', !!userStr); + if (token && userStr) { try { this.currentUser = JSON.parse(userStr); @@ -51,6 +55,8 @@ class AuthManager { console.error('❌ μ‚¬μš©μž 정보 볡원 μ‹€νŒ¨:', error); this.clearAuth(); } + } else { + console.log('❌ 토큰 λ˜λŠ” μ‚¬μš©μž 정보 μ—†μŒ - 둜그인 ν•„μš”'); } } @@ -69,11 +75,13 @@ class AuthManager { * 인증 μƒνƒœ 확인 (ν•„μš”μ‹œμ—λ§Œ API 호좜) */ async checkAuth() { - console.log('πŸ” 인증 μƒνƒœ 확인 μ‹œμž‘'); + console.log('πŸ” AuthManager.checkAuth() 호좜됨'); + console.log('- ν˜„μž¬ 인증 μƒνƒœ:', this.isAuthenticated); + console.log('- ν˜„μž¬ μ‚¬μš©μž:', this.currentUser?.username || 'null'); const token = localStorage.getItem('access_token'); if (!token) { - console.log('❌ 토큰 μ—†μŒ'); + console.log('❌ 토큰 μ—†μŒ - 인증 μ‹€νŒ¨'); this.clearAuth(); return null; } @@ -85,6 +93,7 @@ class AuthManager { } // API 호좜이 ν•„μš”ν•œ 경우 + console.log('πŸ”„ API 호좜 ν•„μš” - refreshAuth μ‹€ν–‰'); return await this.refreshAuth(); }