diff --git a/GatewayApp/Frontend/Plantmonitor.Website/src/features/deviceConfiguration/+page.svelte b/GatewayApp/Frontend/Plantmonitor.Website/src/features/deviceConfiguration/+page.svelte index dcfbd6c3..249b46a1 100644 --- a/GatewayApp/Frontend/Plantmonitor.Website/src/features/deviceConfiguration/+page.svelte +++ b/GatewayApp/Frontend/Plantmonitor.Website/src/features/deviceConfiguration/+page.svelte @@ -144,14 +144,14 @@ const outletClient = new PowerOutletClient(); try { devices = await client.getDevices(); - devices - .filter((d) => d.health.deviceId != undefined) - .forEach(async (element) => { - const deviceId = element.health.deviceId!; - var outlet = await outletClient.powerOutletForDevice(deviceId); - outletByDevice[deviceId] = outlet; - }); + const outletDevices = devices.filter((d) => d.health?.deviceId != undefined); + for (let i = 0; i < outletDevices.length; i++) { + const deviceId = outletDevices[i].health.deviceId!; + var outlet = await outletClient.powerOutletForDevice(deviceId); + outletByDevice[deviceId] = outlet; + } } catch (ex) { + console.log(ex); devices = []; } } @@ -232,10 +232,10 @@ items={existingOutlets}> {/if} + {/if} - diff --git a/GatewayApp/Frontend/Plantmonitor.Website/src/features/reuseableComponents/DeviceSelection.svelte b/GatewayApp/Frontend/Plantmonitor.Website/src/features/reuseableComponents/DeviceSelection.svelte index bf8a8327..af4e8e40 100644 --- a/GatewayApp/Frontend/Plantmonitor.Website/src/features/reuseableComponents/DeviceSelection.svelte +++ b/GatewayApp/Frontend/Plantmonitor.Website/src/features/reuseableComponents/DeviceSelection.svelte @@ -32,7 +32,7 @@ {/each}