修复登录注册验证码bug
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user