fix: ensure charging stations array global property is initialized
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 19 Feb 2024 19:43:21 +0000 (20:43 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 19 Feb 2024 19:43:21 +0000 (20:43 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
ui/web/src/main.ts
ui/web/src/views/ChargingStationsView.vue

index 97f0167a740f8b5390eee6c1882f31933d287101..d0c427bf38036ff3bb30743e691a73cc02637110 100644 (file)
@@ -14,7 +14,11 @@ const initializeApp = (config: ConfigurationData) => {
     console.info('Error info:', info)
     // TODO: add code for UI notifications or other error handling logic
   }
-  app.config.globalProperties.$uiClient = UIClient.getInstance(config.uiServer)
+  app.config.globalProperties.$configuration = config
+  app.config.globalProperties.$chargingStations = []
+  app.config.globalProperties.$uiClient = UIClient.getInstance(
+    app.config.globalProperties.$configuration.uiServer
+  )
   app.config.globalProperties.$uiClient.registerWSEventListener('open', () => {
     app.config.globalProperties.$uiClient
       .listChargingStations()
index 5639c99174d0c9af6480561d87410d17e441781e..b4f7873baf718f29b95635d42f024f76a34c292e 100644 (file)
@@ -12,7 +12,7 @@
         @click="loadChargingStations(() => $router.go(0))"
       />
     </Container>
-    <CSTable :charging-stations="app?.appContext.config.globalProperties.$chargingStations ?? []" />
+    <CSTable :charging-stations="app?.appContext.config.globalProperties.$chargingStations" />
   </Container>
 </template>