-
-
-
- setSsid(e.target.value)}
- />
-
-
-
- setPassword(e.target.value)}
- />
-
-
-
-
-
-
-
+
);
};
diff --git a/src/components/SettingForms/WiFi&Modem/WiFiSettingsForm.tsx b/src/components/SettingForms/WiFi&Modem/WiFiSettingsForm.tsx
new file mode 100644
index 0000000..3f81cd0
--- /dev/null
+++ b/src/components/SettingForms/WiFi&Modem/WiFiSettingsForm.tsx
@@ -0,0 +1,106 @@
+import { Field, Form, Formik } from "formik";
+import FormGroup from "../components/FormGroup";
+import type { WifiSettingValues } from "../../../types/types";
+import { useWifiAndModem } from "../../../hooks/useCameraWifiandModem";
+import { toast } from "sonner";
+
+const WiFiSettingsForm = () => {
+ const { wifiQuery, wifiMutation } = useWifiAndModem();
+
+ const wifiSSID = wifiQuery?.data?.propSSID?.value;
+ const wifiPassword = wifiQuery?.data?.propPassword?.value;
+
+ const initialValues = {
+ ssid: wifiSSID ?? "",
+ password: wifiPassword ?? "",
+ encryption: "WPA2",
+ };
+
+ const handleSubmit = (values: WifiSettingValues) => {
+ const wifiConfig = {
+ id: "ModemAndWifiManager-wifi",
+ configHash: "206890572",
+ propSSID: {
+ value: values.ssid,
+ datatype: "java.lang.String",
+ },
+ propPassword: {
+ value: values.password,
+ datatype: "java.lang.String",
+ },
+ };
+
+ wifiMutation.mutate(wifiConfig);
+ //todo: check what response is
+ toast.success("WiFi settings updated");
+ };
+ return (
+