refactor: extract service installation logic to custom hook and optimize related component handling
This commit is contained in:
@@ -66,7 +66,7 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
|
||||
const onRestart = useLockFn(async () => {
|
||||
try {
|
||||
await restartCore();
|
||||
showNotice('success', t(`Clash Core Restarted`), 1000);
|
||||
showNotice('success', t(`Clash Core Restarted`));
|
||||
} catch (err: any) {
|
||||
showNotice('error', err.message || err.toString());
|
||||
}
|
||||
@@ -77,7 +77,7 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
|
||||
setUpgrading(true);
|
||||
await upgradeCore();
|
||||
setUpgrading(false);
|
||||
showNotice('success', t(`Core Version Updated`), 1000);
|
||||
showNotice('success', t(`Core Version Updated`));
|
||||
} catch (err: any) {
|
||||
setUpgrading(false);
|
||||
showNotice('error', err.response?.data?.message || err.toString());
|
||||
|
||||
@@ -2,7 +2,7 @@ import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { BaseDialog, DialogRef } from "@/components/base";
|
||||
import { getNetworkInterfacesInfo } from "@/services/cmds";
|
||||
import { alpha, Box, Button, Chip, IconButton } from "@mui/material";
|
||||
import { alpha, Box, Button, IconButton } from "@mui/material";
|
||||
import { ContentCopyRounded } from "@mui/icons-material";
|
||||
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
||||
import { showNotice } from "@/services/noticeService";
|
||||
|
||||
Reference in New Issue
Block a user