로그아웃 버튼 및 로직 추가
This commit is contained in:
18
src/main.ts
18
src/main.ts
@@ -118,6 +118,19 @@ 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')!;
|
||||
@@ -200,6 +213,11 @@ function initApp() {
|
||||
pcFlowModal.open();
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.closest('#btn-logout-header')) {
|
||||
logoutAndReturnToLogin();
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
createIcons({
|
||||
|
||||
Reference in New Issue
Block a user