diff --git a/src/pages/Setting.tsx b/src/pages/Setting.tsx index 27c789e..77039e4 100644 --- a/src/pages/Setting.tsx +++ b/src/pages/Setting.tsx @@ -25,9 +25,6 @@ export default function Setting() { // setPort(+evt.target.value); // } // }; - useEffect(() => { - dispatch(fetchConfig()); - }, [dispatch]); useEffect(() => { if (addrInput.current && context.setting.server) { @@ -36,6 +33,10 @@ export default function Setting() { setSelectStandby([context.setting.standbyMinutes]); }, [context.setting]); + useEffect(() => { + dispatch(fetchConfig()); + }, [dispatch]); + const onSaveClick = async () => { const server = addrInput.current!.value; const res = await dispatch(saveConfig({ server, standbyMinutes: selectStandby[0] })).unwrap(); @@ -71,20 +72,24 @@ export default function Setting() { -
-
-

设备设置

-
-
-
setStandbyPickerVisible(true)}> - 自动待机 - - {standbyMinutes.find((r) => r.value === selectStandby[0])?.label || ''} - - arr + + {context.device.connected && ( +
+
+

设备设置

-
-
+
+
setStandbyPickerVisible(true)}> + 自动待机 + + {standbyMinutes.find((r) => r.value === selectStandby[0])?.label || ''} + + arr +
+
+ + )} +