Files
clash-verge-rev/src/hooks/use-verge.ts
T
oomeowandTunglies 8c734a5a35 fix: disable tun mode menu on tray when tun mode is unavailable (#4975)
* fix: check if service installed when toggle tun mode on tray

* chore: cargo fmt

* fix: auto disable tun mode

* docs: update UPDATELOG.md

* fix: init Tun mode status

* chore: update

* feat: disable tun mode tray menu when tun mode is unavailable

* fix: restart core when uninstall service is canceled

* chore: remove check notification when toggle tun mode

* chore: fix updatelog

---------

Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com>
2025-10-31 17:31:40 +08:00

25 lines
488 B
TypeScript

import useSWR from "swr";
import { getVergeConfig, patchVergeConfig } from "@/services/cmds";
export const useVerge = () => {
const { data: verge, mutate: mutateVerge } = useSWR(
"getVergeConfig",
async () => {
const config = await getVergeConfig();
return config;
},
);
const patchVerge = async (value: Partial<IVergeConfig>) => {
await patchVergeConfig(value);
mutateVerge();
};
return {
verge,
mutateVerge,
patchVerge,
};
};