refactor: tun mode is turned on and off, does not depend on services, and does not affect other configurations

This commit is contained in:
huzibaca
2024-10-05 22:45:59 +08:00
parent 7869ce060f
commit 5fdb52d8d0
6 changed files with 28 additions and 158 deletions

View File

@@ -67,20 +67,9 @@ const SettingSystem = ({ onError }: Props) => {
onCatch={onError}
onFormat={onSwitchFormat}
onChange={(e) => {
if (serviceStatus !== "active") {
onChangeData({ enable_tun_mode: false });
} else {
onChangeData({ enable_tun_mode: e });
}
}}
onGuard={(e) => {
if (serviceStatus !== "active" && e) {
Notice.error(t("Please Enable Service Mode"));
return Promise.resolve();
} else {
return patchVerge({ enable_tun_mode: e });
}
onChangeData({ enable_tun_mode: e });
}}
onGuard={(e) => patchVerge({ enable_tun_mode: e })}
>
<Switch edge="end" />
</GuardState>