mirror of
https://github.com/Chanzhaoyu/chatgpt-web.git
synced 2025-07-30 18:48:31 +00:00
21 lines
431 B
TypeScript
21 lines
431 B
TypeScript
import { ss } from '@/utils/storage'
|
|
|
|
const LOCAL_NAME = 'appSetting'
|
|
|
|
export interface AppState {
|
|
siderCollapsed: boolean
|
|
}
|
|
|
|
export function defaultSetting() {
|
|
return { siderCollapsed: false }
|
|
}
|
|
|
|
export function getLocalSetting() {
|
|
const localSetting: AppState | undefined = ss.get(LOCAL_NAME)
|
|
return localSetting ?? defaultSetting()
|
|
}
|
|
|
|
export function setLocalSetting(setting: AppState) {
|
|
ss.set(LOCAL_NAME, setting)
|
|
}
|