feat: implement server restart functionality and refactor logout handling

This commit is contained in:
2026-05-10 18:10:01 +08:00
parent bbb82b350a
commit 566e63e13a
4 changed files with 34 additions and 15 deletions
+23
View File
@@ -0,0 +1,23 @@
import { authApi } from '../api/index.js';
import { deleteCookie as removeCookie } from './functions.js';
async function handleLogout(router) {
try {
await authApi.logout();
} catch (error) {
console.error('Logout API error:', error);
}
removeCookie('token');
removeCookie('username');
removeCookie('user-type');
removeCookie('user-id');
if (router) {
router.push('/login');
}
}
export {
handleLogout
};