implement setting page (#12)

This commit is contained in:
UUBulb
2024-11-23 21:59:48 +08:00
committed by GitHub
parent 34b7a67ab0
commit b474400649
21 changed files with 941 additions and 36 deletions

View File

@@ -3,6 +3,7 @@ import { useServerStore } from "./useServerStore"
import { getServerGroups } from "@/api/server-group"
import { getServers } from "@/api/server"
import { ServerContextProps } from "@/types"
import { useLocation } from "react-router-dom"
const ServerContext = createContext<ServerContextProps>({});
@@ -19,6 +20,8 @@ export const ServerProvider: React.FC<ServerProviderProps> = ({ children, withSe
const server = useServerStore(store => store.server);
const setServer = useServerStore(store => store.setServer);
const location = useLocation();
useEffect(() => {
if (withServerGroup)
(async () => {
@@ -39,7 +42,7 @@ export const ServerProvider: React.FC<ServerProviderProps> = ({ children, withSe
setServer(undefined);
}
})();
}, [])
}, [location.pathname])
const value: ServerContextProps = useMemo(() => ({
servers: server,