summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcubemaze <[email protected]>2023-05-17 18:13:21 +0800
committerLarvan2 <[email protected]>2023-05-17 22:46:03 +0800
commit0aca0fba9b19fbd1cb89b4e5332fdf737aaa58cf (patch)
tree20614a917d8420f4a9efa3767f3cd18733f70f8c /src
parent33fcaaeef95762af8d59167b108439d60dca76ec (diff)
fix: sidebar state
Diffstat (limited to 'src')
-rw-r--r--src/components/SideBar.tsx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx
index fbf5a0e..ef17db2 100644
--- a/src/components/SideBar.tsx
+++ b/src/components/SideBar.tsx
@@ -9,6 +9,8 @@ import { Link, useLocation } from 'react-router-dom';
import { fetchVersion } from '~/api/version';
import { ThemeSwitcher } from '~/components/shared/ThemeSwitcher';
+import { connect } from '~/components/StateProvider';
+import { getClashAPIConfig } from '~/store/app';
import { ClashAPIConfig } from '~/types';
import s from './SideBar.module.scss';
@@ -80,9 +82,16 @@ const pages = [
},
];
-export default function SideBar(props: Props) {
+const mapState = (s) => ({
+ apiConfig: getClashAPIConfig(s),
+});
+
+export default connect(mapState)(SideBar);
+
+function SideBar(props: Props) {
const { t } = useTranslation();
const location = useLocation();
+
const { data: version } = useQuery(['/version', props.apiConfig], () =>
fetchVersion('/version', props.apiConfig)
);