From: Jérôme Benoit Date: Wed, 25 Mar 2026 20:36:53 +0000 (+0100) Subject: refactor(webui): use useChargingStations composable in ChargingStationsView X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=06d32ae9cbd3c2972fe7013fcb78675cd0befdcb;p=e-mobility-charging-stations-simulator.git refactor(webui): use useChargingStations composable in ChargingStationsView --- diff --git a/ui/web/src/views/ChargingStationsView.vue b/ui/web/src/views/ChargingStationsView.vue index 4128c09f..86e0e996 100644 --- a/ui/web/src/views/ChargingStationsView.vue +++ b/ui/web/src/views/ChargingStationsView.vue @@ -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 })