refactor: 替换管理员登录组件并更新会话管理
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
const STORAGE_KEY = "lottery_admin_token";
|
||||
|
||||
export function readStoredAdminToken(): string | null {
|
||||
if (typeof window === "undefined") {
|
||||
return null;
|
||||
}
|
||||
const raw = window.localStorage.getItem(STORAGE_KEY)?.trim();
|
||||
|
||||
return raw && raw !== "" ? raw : null;
|
||||
}
|
||||
|
||||
export function writeStoredAdminToken(token: string | null): void {
|
||||
if (typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
if (token && token.trim() !== "") {
|
||||
window.localStorage.setItem(STORAGE_KEY, token.trim());
|
||||
} else {
|
||||
window.localStorage.removeItem(STORAGE_KEY);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user