mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-02-04 12:40:08 +00:00
implement setting page (#12)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user