17 lines
383 B
TypeScript
17 lines
383 B
TypeScript
// 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"
|
|
}
|
|
};
|
|
};
|