refactor: filter store (#1331)

This commit is contained in:
boojack
2023-03-11 09:13:54 +08:00
committed by GitHub
parent f3f0efba1e
commit a9218ed5f0
23 changed files with 215 additions and 327 deletions

View File

@ -4,7 +4,7 @@ import { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { RouterProvider } from "react-router-dom";
import router from "./router";
import { useLocationStore, useGlobalStore } from "./store/module";
import { useGlobalStore } from "./store/module";
import * as storage from "./helpers/storage";
import { getSystemColorScheme } from "./helpers/utils";
import Loading from "./pages/Loading";
@ -12,17 +12,9 @@ import Loading from "./pages/Loading";
const App = () => {
const { i18n } = useTranslation();
const globalStore = useGlobalStore();
const locationStore = useLocationStore();
const { mode, setMode } = useColorScheme();
const { appearance, locale, systemStatus } = globalStore.state;
useEffect(() => {
locationStore.updateStateWithLocation();
window.onpopstate = () => {
locationStore.updateStateWithLocation();
};
}, []);
useEffect(() => {
const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
const handleColorSchemeChange = (e: MediaQueryListEvent) => {