]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor(webui): use useChargingStations composable in ChargingStationsView
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 25 Mar 2026 20:36:53 +0000 (21:36 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 25 Mar 2026 20:36:53 +0000 (21:36 +0100)
ui/web/src/views/ChargingStationsView.vue

index 4128c09f58182e431fc91aeaf24f1f40c2d104e8..86e0e996420de126588a9ad1c9056b131e623a15 100644 (file)
@@ -136,6 +136,7 @@ import {
   getLocalStorage,
   randomUUID,
   setToLocalStorage,
+  useChargingStations,
   useUIClient,
 } from '@/composables'
 
@@ -179,7 +180,7 @@ const clearToggleButtons = (): void => {
 
 const app = getCurrentInstance()
 
-const chargingStationsRef = app?.appContext.config.globalProperties.$chargingStations
+const chargingStationsRef = useChargingStations()
 if (chargingStationsRef != null) {
   watch(chargingStationsRef, () => {
     state.value.renderChargingStations = randomUUID()
@@ -193,8 +194,8 @@ const clearTemplates = (): void => {
 }
 
 const clearChargingStations = (): void => {
-  if (app != null) {
-    app.appContext.config.globalProperties.$chargingStations!.value = []
+  if (chargingStationsRef != null) {
+    chargingStationsRef.value = []
   }
 }
 
@@ -249,9 +250,8 @@ const getChargingStations = (): void => {
     uiClient
       .listChargingStations()
       .then((response: ResponsePayload) => {
-        if (app != null) {
-          app.appContext.config.globalProperties.$chargingStations!.value =
-            response.chargingStations as ChargingStationData[]
+        if (chargingStationsRef != null) {
+          chargingStationsRef.value = response.chargingStations as ChargingStationData[]
         }
         return undefined
       })