- state.chargingStations = (await UIClient.listChargingStations())
- .chargingStations as ChargingStationData[]
- state.isLoading = false
+ uiClient
+ .listChargingStations()
+ .then((response: ResponsePayload) => {
+ if (app != null) {
+ app.appContext.config.globalProperties.$chargingStations = response.chargingStations
+ }
+ })
+ .catch((error: Error) => {
+ $toast.error('Error at fetching charging stations')
+ console.error('Error at fetching charging stations:', error)
+ })
+ .finally(() => {
+ if (reloadCallback != null) {
+ reloadCallback()
+ }
+ state.isLoading = false
+ })