로그아웃 버튼 및 로직 추가 네비게이션 스크립트 수정
All checks were successful
ITAM Code Check / build-and-config-check (push) Successful in 12s
ITAM Docker Build Check / docker-build-check (push) Successful in 18s

This commit is contained in:
2026-07-01 14:59:44 +09:00
parent 565fac12ed
commit 2512082402
3 changed files with 18 additions and 21 deletions

View File

@@ -66,9 +66,6 @@
<button id="btn-open-guide-header" class="btn btn-outline" title="프로세스 가이드">
<i data-lucide="book-open"></i> 가이드
</button>
<button id="btn-logout-header" class="btn btn-outline btn-sm" title="로그아웃">
로그아웃
</button>
</div>
</div>
</header>

View File

@@ -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) {
<div class="notification-area">
<button class="icon-btn" title="알림"><i data-lucide="bell" style="width:18px; height:18px;"></i></button>
</div>
<button id="btn-logout-header" class="btn btn-outline btn-sm" title="로그아웃">로그아웃</button>
</div>
`;
@@ -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();

View File

@@ -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({