From 30fa79b55e0128c26fc4659be12436bbccb8a05a Mon Sep 17 00:00:00 2001 From: Aleksandr Gumroian Date: Thu, 5 Dec 2024 09:36:47 +0100 Subject: [PATCH] !fixup WiFi API update --- src/common/WiFiSettings/WiFiForm.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/common/WiFiSettings/WiFiForm.js b/src/common/WiFiSettings/WiFiForm.js index 40198d9..9475f57 100644 --- a/src/common/WiFiSettings/WiFiForm.js +++ b/src/common/WiFiSettings/WiFiForm.js @@ -156,25 +156,25 @@ function DeviceForm({ { - // Get the last item in an array of available HT modes - const [best2] = bnds[0].available_htmodes.slice(-1); - const [best5] = bnds[1].available_htmodes.slice(-1); + // Find the selected band + const selectedBand = bnds.find( + (band) => band.band === value + ); + // Get the last item in the available HT modes for the selected band + const bestHtmode = + selectedBand.available_htmodes.slice(-1)[0]; return { devices: { [deviceIndex]: { band: { $set: value }, channel: { $set: "0" }, - htmode: { - $set: - // Set HT mode depending on checked frequency - value === "11a" ? best5 : best2, - }, + htmode: { $set: bestHtmode }, }, }, }; @@ -293,7 +293,7 @@ function getHtmodeChoices(device) { function getBandChoices(device) { return device.available_bands.map((availableBand) => ({ - label: BANDS[availableBand.band], + label: BANDS[availableBand.band] + _(" GHz"), value: availableBand.band, })); }