From 0bcadab98cfc5fe619c7180125f8c56dd172d136 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 1 Dec 2023 11:22:05 +0800 Subject: [PATCH] Fix hide sidebar wrong local storage key --- src/components/common/sidebar/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/sidebar/index.tsx b/src/components/common/sidebar/index.tsx index cf8e542..5060455 100644 --- a/src/components/common/sidebar/index.tsx +++ b/src/components/common/sidebar/index.tsx @@ -13,11 +13,11 @@ interface SidebarProps extends React.PropsWithChildren { } const Sidebar: React.FC = (props) => { - const [hideSidebar, setHideSidebar] = useState(getLocalStorage('hideSidebar') === 'false') + const [hideSidebar, setHideSidebar] = useState(getLocalStorage('HIDE_SIDEBAR') === 'true') const switchSidebar = () => { + setLocalStorage('HIDE_SIDEBAR', !hideSidebar ? 'true' : 'false') setHideSidebar(!hideSidebar) - setLocalStorage('hideSidebar', hideSidebar ? 'true' : 'false') props.onSidebarSwitch && props.onSidebarSwitch(hideSidebar) }