mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-05-19 10:32:56 +00:00
select current ssid by default if connected via wifi-station
This commit is contained in:
parent
303a0ae0fc
commit
b847fb3d20
1 changed files with 8 additions and 3 deletions
|
@ -7,7 +7,7 @@ const refreshIcon = refreshButton.querySelector("img");
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
|
|
||||||
refreshButton.addEventListener("click", async () => {
|
refreshButton.addEventListener("click", async () => {
|
||||||
// check if interface is connected via WiFi-AccessPoint
|
// check if interface is connected via WiFi
|
||||||
if (data.connection == 0 || data.connection == 1) {
|
if (data.connection == 0 || data.connection == 1) {
|
||||||
alert(
|
alert(
|
||||||
"Beim WLAN-Scan wird die Verbindung hardwarebedingt kurzzeitig" +
|
"Beim WLAN-Scan wird die Verbindung hardwarebedingt kurzzeitig" +
|
||||||
|
@ -18,8 +18,13 @@ refreshButton.addEventListener("click", async () => {
|
||||||
updateNetworks();
|
updateNetworks();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// check if connected via WiFi-Station
|
||||||
|
if (data.connection === 0) {
|
||||||
|
// show currently connected wifi
|
||||||
|
insertNetworks([data.ssid]);
|
||||||
|
}
|
||||||
|
|
||||||
function insertNetworks(networks) {
|
function insertNetworks(networks) {
|
||||||
networks.unshift(""); // add empty option
|
|
||||||
networkDropdown.textContent = ""; // clear dropdown
|
networkDropdown.textContent = ""; // clear dropdown
|
||||||
|
|
||||||
for (const ssid of networks) {
|
for (const ssid of networks) {
|
||||||
|
@ -63,6 +68,6 @@ async function loadNetworks() {
|
||||||
async function updateNetworks() {
|
async function updateNetworks() {
|
||||||
const networks = await loadNetworks();
|
const networks = await loadNetworks();
|
||||||
if (networks) {
|
if (networks) {
|
||||||
insertNetworks(networks);
|
insertNetworks(["", ...networks], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue