refactor(ui): trivial code cleanup
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 15 Feb 2024 11:03:25 +0000 (12:03 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 15 Feb 2024 11:03:25 +0000 (12:03 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
ui/web/src/views/ChargingStationsView.vue

index be7aefbed233f22451e5ace386402222145ad0d0..9243b98febe03cc75a4f1a595a9287aeef4012f2 100644 (file)
@@ -42,12 +42,12 @@ const state: State = reactive({
 })
 
 async function load(): Promise<void> {
-  if (state.isLoading === true) return
-  state.isLoading = true
-  const listChargingStationsPayload = await UIClient.listChargingStations()
-  state.chargingStations =
-    listChargingStationsPayload.chargingStations as unknown as ChargingStationData[]
-  state.isLoading = false
+  if (state.isLoading === false) {
+    state.isLoading = true
+    state.chargingStations = (await UIClient.listChargingStations())
+      .chargingStations as ChargingStationData[]
+    state.isLoading = false
+  }
 }
 
 function startSimulator(): void {