mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-06 02:53:45 +08:00
fix: check service
This commit is contained in:
parent
bc9cbd2993
commit
7b887e4cdd
@ -41,8 +41,11 @@ export const ServiceViewer = forwardRef<DialogRef, Props>((props, ref) => {
|
|||||||
const onInstall = useLockFn(async () => {
|
const onInstall = useLockFn(async () => {
|
||||||
try {
|
try {
|
||||||
await installService();
|
await installService();
|
||||||
mutateCheck();
|
await mutateCheck();
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
setTimeout(() => {
|
||||||
|
mutateCheck();
|
||||||
|
}, 2000);
|
||||||
Notice.success(t("Service Installed Successfully"));
|
Notice.success(t("Service Installed Successfully"));
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
mutateCheck();
|
mutateCheck();
|
||||||
|
@ -4,6 +4,7 @@ import { checkService } from "@/services/cmds";
|
|||||||
import { useVerge } from "@/hooks/use-verge";
|
import { useVerge } from "@/hooks/use-verge";
|
||||||
import getSystem from "@/utils/get-system";
|
import getSystem from "@/utils/get-system";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
const isWIN = getSystem() === "windows";
|
const isWIN = getSystem() === "windows";
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ export const StackModeSwitch = (props: Props) => {
|
|||||||
const { verge } = useVerge();
|
const { verge } = useVerge();
|
||||||
const { enable_service_mode } = verge ?? {};
|
const { enable_service_mode } = verge ?? {};
|
||||||
// service mode
|
// service mode
|
||||||
const { data: serviceStatus } = useSWR(
|
const { data: serviceStatus, mutate: mutateCheck } = useSWR(
|
||||||
isWIN ? "checkService" : null,
|
isWIN ? "checkService" : null,
|
||||||
checkService,
|
checkService,
|
||||||
{
|
{
|
||||||
@ -28,6 +29,10 @@ export const StackModeSwitch = (props: Props) => {
|
|||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
mutateCheck();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={
|
title={
|
||||||
|
Loading…
x
Reference in New Issue
Block a user