修复登录注册验证码bug

This commit is contained in:
Eamon
2026-08-14 16:30:41 +08:00
parent 4235458bea
commit 1336a550fe
9 changed files with 593 additions and 371 deletions

View File

@@ -1,4 +1,4 @@
const AUTH_EVENT = "auth-change"
export const AUTH_EVENT = "auth-change"
const TOKEN_KEY = "auth_token"
const USER_KEY = "auth_user"
@@ -8,6 +8,11 @@ export function readCookie(name: string): string | null {
return match ? decodeURIComponent(match[1]) : null
}
export function clearCookie(name: string) {
// biome-ignore lint/suspicious/noDocumentCookie: Cookie Store API 兼容性不足,标准做法是覆盖写入
document.cookie = `${name}=; max-age=0; path=/`
}
export function getUserToken(): string | null {
return localStorage.getItem(TOKEN_KEY)
}