Fix hide sidebar wrong local storage key

This commit is contained in:
2023-12-01 11:22:05 +08:00
parent 85e7f121ef
commit 0bcadab98c

View File

@@ -13,11 +13,11 @@ interface SidebarProps extends React.PropsWithChildren {
} }
const Sidebar: React.FC<SidebarProps> = (props) => { const Sidebar: React.FC<SidebarProps> = (props) => {
const [hideSidebar, setHideSidebar] = useState(getLocalStorage('hideSidebar') === 'false') const [hideSidebar, setHideSidebar] = useState(getLocalStorage('HIDE_SIDEBAR') === 'true')
const switchSidebar = () => { const switchSidebar = () => {
setLocalStorage('HIDE_SIDEBAR', !hideSidebar ? 'true' : 'false')
setHideSidebar(!hideSidebar) setHideSidebar(!hideSidebar)
setLocalStorage('hideSidebar', hideSidebar ? 'true' : 'false')
props.onSidebarSwitch && props.onSidebarSwitch(hideSidebar) props.onSidebarSwitch && props.onSidebarSwitch(hideSidebar)
} }