From b7799b48422acbce51ccc4a7a87eaa4cc166567d Mon Sep 17 00:00:00 2001 From: Rune Harlyk Date: Tue, 3 Sep 2024 20:47:07 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=9C=20Simplify=20wifi=20services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/routes/wifi/sta/Scan.svelte | 4 ++-- app/src/routes/wifi/sta/Wifi.svelte | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/routes/wifi/sta/Scan.svelte b/app/src/routes/wifi/sta/Scan.svelte index 2dc019d1..de7921ca 100644 --- a/app/src/routes/wifi/sta/Scan.svelte +++ b/app/src/routes/wifi/sta/Scan.svelte @@ -33,7 +33,6 @@ async function scanNetworks() { scanActive = true; - await api.get('/api/scanNetworks'); if ((await pollingResults()) == false) { pollingId = setInterval(() => pollingResults(), 1000); } @@ -41,8 +40,9 @@ } async function pollingResults() { - const result = await api.get('/api/listNetworks'); if (result.isErr()){ + await api.get('/api/wifi/scan'); + const result = await api.get('/api/wifi/networks'); console.error(`Error occurred while fetching: `, result.inner); return false } diff --git a/app/src/routes/wifi/sta/Wifi.svelte b/app/src/routes/wifi/sta/Wifi.svelte index f7dbf648..8aa0caef 100644 --- a/app/src/routes/wifi/sta/Wifi.svelte +++ b/app/src/routes/wifi/sta/Wifi.svelte @@ -77,7 +77,6 @@ let formErrorhostname = false; async function getWifiStatus() { - const result = await api.get('/api/wifiStatus'); if (result.isErr()) { console.error(`Error occurred while fetching: `, result.inner); return; @@ -87,7 +86,6 @@ } async function getWifiSettings() { - const result = await api.get('/api/wifiSettings'); if (result.isErr()) { console.error(`Error occurred while fetching: `, result.inner); return; @@ -107,7 +105,6 @@ }); async function postWiFiSettings(data: WifiSettings) { - const result = await api.post('/api/wifiSettings', data); if (result.isErr()) { console.error(`Error occurred while fetching: `, result.inner); notifications.error('User not authorized.', 3000); @@ -285,6 +282,9 @@ dndNetworkList = reorder(dndNetworkList, from.index, to.index); console.log(dndNetworkList); } + const result = await api.get('/api/wifi/status'); + const result = await api.get('/api/wifi/settings'); + const result = await api.post('/api/wifi/settings', data);