feat: 增加登录限流和跨进程退出机制

This commit is contained in:
2026-07-10 11:47:28 +08:00
parent 5aca872129
commit aedecb3aab
7 changed files with 180 additions and 16 deletions

View File

@@ -496,9 +496,13 @@ async function login() {
}
}
function logout() {
clearToken();
admin.value = null;
async function logout() {
try {
await api.logout();
} finally {
clearToken();
admin.value = null;
}
}
async function switchMenu(menu: string) {

View File

@@ -84,6 +84,7 @@ export const api = {
method: "POST",
body: JSON.stringify({ username, password }),
}),
logout: () => request<null>("/admin/logout", { method: "POST", body: "{}" }),
profile: () => request<AdminProfile>("/admin/profile"),
dashboard: (start?: string, end?: string) => {
const params = new URLSearchParams();