Skip to content
Snippets Groups Projects
Unverified Commit eb86b471 authored by GyDi's avatar GyDi
Browse files

fix: something

parent 2b525845
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,7 @@ const SettingClash = ({ onError }: Props) => { ...@@ -50,7 +50,7 @@ const SettingClash = ({ onError }: Props) => {
// restart clash when port is changed // restart clash when port is changed
const { run: onUpdatePort } = useDebounceFn( const { run: onUpdatePort } = useDebounceFn(
async (port: number) => { async (port: number) => {
(async () => { try {
if (port < 1000) { if (port < 1000) {
throw new Error("The port should not < 1000"); throw new Error("The port should not < 1000");
} }
...@@ -61,10 +61,10 @@ const SettingClash = ({ onError }: Props) => { ...@@ -61,10 +61,10 @@ const SettingClash = ({ onError }: Props) => {
onChangeData({ "mixed-port": port }); onChangeData({ "mixed-port": port });
setPort(port); setPort(port);
Notice.success("Change Clash port successfully!"); Notice.success("Change Clash port successfully!");
})().catch((err: any) => { } catch (err: any) {
setMixedPort(thePort); // back to old port value setMixedPort(thePort); // back to old port value
Notice.error(err.message ?? err.toString()); Notice.error(err.message ?? err.toString());
}); }
}, },
{ wait: 1000 } { wait: 1000 }
); );
...@@ -72,8 +72,7 @@ const SettingClash = ({ onError }: Props) => { ...@@ -72,8 +72,7 @@ const SettingClash = ({ onError }: Props) => {
// get clash core version // get clash core version
const [clashVer, setClashVer] = useState(""); const [clashVer, setClashVer] = useState("");
useEffect(() => { useEffect(() => {
getVersion().then((res) => { getVersion().then(({ premium, version }) => {
const { premium, version } = res;
setClashVer(premium ? `${version} Premium` : version); setClashVer(premium ? `${version} Premium` : version);
}); });
}, []); }, []);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment