From 2512082402aa0599750feb26d17bf49cfa7f0d67 Mon Sep 17 00:00:00 2001 From: SDI Date: Wed, 1 Jul 2026 14:59:44 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EB=B0=8F=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=84=A4=EB=B9=84=EA=B2=8C=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 3 --- src/components/Navigation.ts | 18 ++++++++++++++++++ src/main.ts | 18 ------------------ 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index 7439a27..a1f4b33 100644 --- a/index.html +++ b/index.html @@ -66,9 +66,6 @@ - diff --git a/src/components/Navigation.ts b/src/components/Navigation.ts index aa53723..197f9c1 100644 --- a/src/components/Navigation.ts +++ b/src/components/Navigation.ts @@ -28,6 +28,19 @@ export function renderNavigation(onTabChange: (tab: string) => void) { const headerContainer = document.querySelector('.header-container')!; if (!headerContainer) return; + const logoutAndReturnToLogin = async () => { + try { + await fetch('/api/auth/logout', { + method: 'POST', + headers: { 'Content-Type': 'application/json' } + }); + } catch (error) { + console.error('Logout failed:', error); + } + + window.location.href = '/'; + }; + const render = () => { // 1. 헤더 구조 (Vercel Style: Clean Single Row) headerContainer.innerHTML = ` @@ -50,6 +63,7 @@ export function renderNavigation(onTabChange: (tab: string) => void) {
+ `; @@ -121,6 +135,10 @@ export function renderNavigation(onTabChange: (tab: string) => void) { onTabChange(state.activeSubTab); }); + document.getElementById('btn-logout-header')?.addEventListener('click', () => { + logoutAndReturnToLogin(); + }); + // 아이콘 생성 // @ts-ignore if (window.lucide) window.lucide.createIcons(); diff --git a/src/main.ts b/src/main.ts index 648c059..1822703 100644 --- a/src/main.ts +++ b/src/main.ts @@ -118,19 +118,6 @@ async function refreshAllData() { refreshView(); } -async function logoutAndReturnToLogin() { - try { - await fetch('/api/auth/logout', { - method: 'POST', - headers: { 'Content-Type': 'application/json' } - }); - } catch (error) { - console.error('Logout failed:', error); - } - - window.location.href = '/'; -} - // --- App Initialization --- function initApp() { const mainContent = document.getElementById('main-content')!; @@ -213,11 +200,6 @@ function initApp() { pcFlowModal.open(); return; } - - if (target.closest('#btn-logout-header')) { - logoutAndReturnToLogin(); - return; - } }); createIcons({