2022-08-19 21:13:41 +08:00
|
|
|
/** 统一处理 localStorage */
|
|
|
|
|
2022-08-22 14:30:08 +08:00
|
|
|
import CacheKey from "@/constants/cacheKey"
|
2022-08-24 16:52:01 +08:00
|
|
|
import type { ThemeName } from "@/config/theme"
|
2022-08-19 21:13:41 +08:00
|
|
|
|
2022-08-24 16:52:01 +08:00
|
|
|
export const getSidebarStatus = () => {
|
|
|
|
return localStorage.getItem(CacheKey.SIDEBAR_STATUS)
|
|
|
|
}
|
|
|
|
export const setSidebarStatus = (sidebarStatus: "opened" | "closed") => {
|
|
|
|
localStorage.setItem(CacheKey.SIDEBAR_STATUS, sidebarStatus)
|
|
|
|
}
|
2022-08-19 21:13:41 +08:00
|
|
|
|
2022-08-24 16:52:01 +08:00
|
|
|
export const getActiveThemeName = () => {
|
|
|
|
return localStorage.getItem(CacheKey.ACTIVE_THEME_NAME) as ThemeName
|
|
|
|
}
|
|
|
|
export const setActiveThemeName = (themeName: ThemeName) => {
|
|
|
|
localStorage.setItem(CacheKey.ACTIVE_THEME_NAME, themeName)
|
|
|
|
}
|