Skip to content

Commit

Permalink
🛜 Simplify wifi services
Browse files Browse the repository at this point in the history
  • Loading branch information
runeharlyk committed Sep 3, 2024
1 parent e69e485 commit b7799b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/src/routes/wifi/sta/Scan.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
async function scanNetworks() {
scanActive = true;
await api.get('/api/scanNetworks');
if ((await pollingResults()) == false) {
pollingId = setInterval(() => pollingResults(), 1000);
}
return;
}
async function pollingResults() {
const result = await api.get<NetworkList>('/api/listNetworks');
if (result.isErr()){
await api.get('/api/wifi/scan');
const result = await api.get<NetworkList>('/api/wifi/networks');
console.error(`Error occurred while fetching: `, result.inner);
return false
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/routes/wifi/sta/Wifi.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
let formErrorhostname = false;
async function getWifiStatus() {
const result = await api.get<WifiStatus>('/api/wifiStatus');
if (result.isErr()) {
console.error(`Error occurred while fetching: `, result.inner);
return;
Expand All @@ -87,7 +86,6 @@
}
async function getWifiSettings() {
const result = await api.get<WifiSettings>('/api/wifiSettings');
if (result.isErr()) {
console.error(`Error occurred while fetching: `, result.inner);
return;
Expand All @@ -107,7 +105,6 @@
});
async function postWiFiSettings(data: WifiSettings) {
const result = await api.post<WifiSettings>('/api/wifiSettings', data);
if (result.isErr()) {
console.error(`Error occurred while fetching: `, result.inner);
notifications.error('User not authorized.', 3000);
Expand Down Expand Up @@ -285,6 +282,9 @@
dndNetworkList = reorder(dndNetworkList, from.index, to.index);
console.log(dndNetworkList);
}
const result = await api.get<WifiStatus>('/api/wifi/status');
const result = await api.get<WifiSettings>('/api/wifi/settings');
const result = await api.post<WifiSettings>('/api/wifi/settings', data);
</script>

<SettingsCard collapsible={false}>
Expand Down

0 comments on commit b7799b4

Please sign in to comment.