chore: update

This commit is contained in:
huzibaca
2024-09-25 21:07:01 +08:00
parent ec2bf37ad4
commit 2aa3c8cfe1
3 changed files with 44 additions and 5 deletions

View File

@@ -27,6 +27,7 @@ import "dayjs/locale/zh-cn";
import { getPortableFlag } from "@/services/cmds";
import React from "react";
import { TransitionGroup, CSSTransition } from "react-transition-group";
import { useListen } from "@/hooks/use-listen";
const appWindow = getCurrentWebviewWindow();
export let portableFlag = false;
@@ -46,10 +47,13 @@ const Layout = () => {
const navigate = useNavigate();
const location = useLocation();
const routersEles = useRoutes(routers);
const { addListener, setupCloseListener } = useListen();
if (!routersEles) return null;
setupCloseListener();
useEffect(() => {
listen("verge://refresh-clash-config", async () => {
addListener("verge://refresh-clash-config", async () => {
// the clash info may be updated
await getAxios(true);
mutate("getProxies");
@@ -59,10 +63,10 @@ const Layout = () => {
});
// update the verge config
listen("verge://refresh-verge-config", () => mutate("getVergeConfig"));
addListener("verge://refresh-verge-config", () => mutate("getVergeConfig"));
// 设置提示监听
listen("verge://notice-message", ({ payload }) => {
addListener("verge://notice-message", ({ payload }) => {
const [status, msg] = payload as [string, string];
switch (status) {
case "import_sub_url::ok":