diff --git a/src/components/SettingForms/Channel1-JSON/ChannelCard.tsx b/src/components/SettingForms/Channel1-JSON/ChannelCard.tsx index 3d2e1a1..5bc6454 100644 --- a/src/components/SettingForms/Channel1-JSON/ChannelCard.tsx +++ b/src/components/SettingForms/Channel1-JSON/ChannelCard.tsx @@ -27,7 +27,7 @@ const ChannelCard = ({ touched, isSubmitting, isBof2ConstantsLoading, isDispatch connectTimeoutSeconds: Number(d?.propConnectTimeoutSeconds?.value), readTimeoutSeconds: Number(d?.propReadTimeoutSeconds?.value), }; - }, [backOfficeQuery.data]); + }, [backOfficeQuery?.data]); useEffect(() => { if (!backOfficeQuery?.isSuccess) return; diff --git a/src/components/SettingForms/SettingForms/SettingForms.tsx b/src/components/SettingForms/SettingForms/SettingForms.tsx index b68600e..6ff7f28 100644 --- a/src/components/SettingForms/SettingForms/SettingForms.tsx +++ b/src/components/SettingForms/SettingForms/SettingForms.tsx @@ -29,6 +29,7 @@ const SettingForms = () => { const sightingQuality = sightingAmendQuery?.data?.propOverviewQuality?.value; const cropSizeFactor = sightingAmendQuery?.data?.propOverviewImageScaleFactor?.value; + const laneID = laneIdQuery?.data?.id; const LID1 = laneIdQuery?.data?.propLaneID1?.value; const LID2 = laneIdQuery?.data?.propLaneID2?.value; @@ -58,6 +59,7 @@ const SettingForms = () => { GPSFormat: GPSFormat ?? "", //BOF2 - optional Lane IDs + laneId: laneID ?? "", LID1: LID1 ?? "", LID2: LID2 ?? "", }; @@ -109,6 +111,7 @@ const SettingForms = () => { }; const bof2LaneData: OptionalBOF2LaneIDs = { + laneId: laneIdQuery?.data?.id, LID1: values.LID1, LID2: values.LID2, LID3: values.LID3, diff --git a/src/hooks/useBackOfficeConfig.ts b/src/hooks/useBackOfficeConfig.ts index 63f936b..f7f8d43 100644 --- a/src/hooks/useBackOfficeConfig.ts +++ b/src/hooks/useBackOfficeConfig.ts @@ -36,7 +36,7 @@ const updateBackOfficeConfig = async (data: InitialValuesForm) => { }, ], }; - const response = await fetch(`${CAM_BASE}/api/update-config?id=Dispatcher`, { + const response = await fetch(`${CAM_BASE}/api/update-config`, { method: "POST", body: JSON.stringify(updateConfigPayload), }); diff --git a/src/hooks/useCameraOutput.ts b/src/hooks/useCameraOutput.ts index 8473a9a..4bdb9ca 100644 --- a/src/hooks/useCameraOutput.ts +++ b/src/hooks/useCameraOutput.ts @@ -24,7 +24,7 @@ const updateDispatcherConfig = async (data: BearerTypeFieldType) => { }, ], }; - const response = await fetch(`${CAM_BASE}/api/update-config?id=Dispatcher`, { + const response = await fetch(`${CAM_BASE}/api/update-config`, { method: "POST", body: JSON.stringify(updateConfigPayload), }); @@ -54,7 +54,7 @@ const updateBackOfficeDispatcher = async (data: OptionalBOF2Constants) => { }, ], }; - const response = await fetch(`${CAM_BASE}/api/update-config?id=Dispatcher-bof2-constants`, { + const response = await fetch(`${CAM_BASE}/api/update-config`, { method: "POST", body: JSON.stringify(bof2ContantsPayload), }); @@ -70,7 +70,7 @@ const getBof2DispatcherData = async () => { const updateBOF2LaneId = async (data: OptionalBOF2LaneIDs) => { const bof2LaneIds = { - id: "SightingAmmendA-lane-ids", + id: data?.laneId, fields: [ { property: "propLaneID1", @@ -83,7 +83,7 @@ const updateBOF2LaneId = async (data: OptionalBOF2LaneIDs) => { ], }; - const response = await fetch(`${CAM_BASE}/api/update-config?id=SightingAmmendA-lane-ids`, { + const response = await fetch(`${CAM_BASE}/api/update-config`, { method: "post", body: JSON.stringify(bof2LaneIds), }); diff --git a/src/hooks/useCameraWifiandModem.ts b/src/hooks/useCameraWifiandModem.ts index 7ca2192..c099a63 100644 --- a/src/hooks/useCameraWifiandModem.ts +++ b/src/hooks/useCameraWifiandModem.ts @@ -16,7 +16,7 @@ const getWiFiSettings = async () => { }; const updateWifiSettings = async (wifiConfig: WifiConfig) => { - const response = await fetch(`${camBase}/api/update-config?id=ModemAndWifiManager-wifi`, { + const response = await fetch(`${camBase}/api/update-config`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(wifiConfig), @@ -38,7 +38,7 @@ const getModemSettings = async () => { }; const updateModemSettings = async (modemConfig: ModemConfig) => { - const response = await fetch(`${camBase}/api/update-config?id=ModemAndWifiManager-modem`, { + const response = await fetch(`${camBase}/api/update-config`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(modemConfig), diff --git a/src/hooks/useSystemConfig.ts b/src/hooks/useSystemConfig.ts index 9dfd397..989251f 100644 --- a/src/hooks/useSystemConfig.ts +++ b/src/hooks/useSystemConfig.ts @@ -28,11 +28,11 @@ const updateDNSSettings = async (data: DNSSettingsType) => { }, ], }; - const response = await fetch(`${camBase}/api/update-config?id=GLOBAL--NetworkConfig`, { + const response = await fetch(`${camBase}/api/update-config`, { method: "post", body: JSON.stringify(dnsSettingsPayload), }); - if (!response.ok) throw new Error("cannot send to dns endpoint"); + if (!response.ok) throw new Error("cannot send to DNS endpoint"); return response.json(); }; diff --git a/src/types/types.ts b/src/types/types.ts index ffae011..2da3246 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -78,6 +78,7 @@ export type OptionalBOF2Constants = { }; export type OptionalBOF2LaneIDs = { + laneId?: string; LID1?: string; LID2?: string; LID3?: string;