getLocalStorage,
randomUUID,
setToLocalStorage,
+ useChargingStations,
useUIClient,
} from '@/composables'
const app = getCurrentInstance()
-const chargingStationsRef = app?.appContext.config.globalProperties.$chargingStations
+const chargingStationsRef = useChargingStations()
if (chargingStationsRef != null) {
watch(chargingStationsRef, () => {
state.value.renderChargingStations = randomUUID()
}
const clearChargingStations = (): void => {
- if (app != null) {
- app.appContext.config.globalProperties.$chargingStations!.value = []
+ if (chargingStationsRef != null) {
+ chargingStationsRef.value = []
}
}
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
})