feat: auto close connection when proxy changed

This commit is contained in:
GyDi
2022-11-10 01:27:05 +08:00
parent 5f486d0f51
commit 0cfd718d8a
9 changed files with 175 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
import useSWR from "swr";
import { getVergeConfig, patchVergeConfig } from "@/services/cmds";
export const useVergeConfig = () => {
const { data, mutate } = useSWR("getVergeConfig", getVergeConfig);
const patchVerge = async (value: Partial<CmdType.VergeConfig>) => {
await patchVergeConfig(value);
mutate();
};
return {
data,
patchVerge,
};
};