This commit is contained in:
2025-03-20 18:06:22 +08:00
parent 9ad083b014
commit a2ef989b75
4 changed files with 71 additions and 1 deletions

16
lib/client/storage.ts Normal file
View File

@@ -0,0 +1,16 @@
// lib/client/storage.ts
export const CLIENT_STORAGE_KEYS = {
THEME: "theme",
LANG: "lang"
} as const;
export const getInitialState = () => {
if (typeof window === "undefined") return {};
return {
uiStore: {
theme: localStorage.getItem(CLIENT_STORAGE_KEYS.THEME) || "light",
language: localStorage.getItem(CLIENT_STORAGE_KEYS.LANG) || "zh-CN"
}
};
};