refactor(ui): cleanup variables namespace
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 27 Feb 2024 00:38:32 +0000 (01:38 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 27 Feb 2024 00:38:32 +0000 (01:38 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
ui/web/src/views/ChargingStationsView.vue

index 18b0cc028d1373845cf5a3f4e73f8c83339a5958..113137c80a44a5eb302c0d1cead562f5acae90ad 100644 (file)
@@ -44,7 +44,7 @@
       <ReloadButton
         id="reload-button"
         :loading="state.loading"
-        @click="loadChargingStations(() => (state.reload = randomUUID()))"
+        @click="loadChargingStations(() => (state.renderChargingStationsList = randomUUID()))"
       />
     </Container>
     <CSTable
@@ -52,7 +52,7 @@
         Array.isArray(app?.appContext.config.globalProperties.$chargingStations) &&
         app?.appContext.config.globalProperties.$chargingStations.length > 0
       "
-      :key="state.reload"
+      :key="state.renderChargingStationsList"
       :charging-stations="app?.appContext.config.globalProperties.$chargingStations"
     />
   </Container>
@@ -73,8 +73,8 @@ const randomUUID = (): `${string}-${string}-${string}-${string}-${string}` => {
 }
 
 const state = reactive({
+  renderChargingStationsList: randomUUID(),
   loading: false,
-  reload: randomUUID(),
   uiServerIndex: getFromLocalStorage<number>('uiServerConfigurationIndex', 0)
 })
 
@@ -90,7 +90,7 @@ const uiServerConfigurations: { configuration: UIServerConfigurationSection; ind
 
 const $toast = useToast()
 
-const loadChargingStations = (reloadCallback?: () => void): void => {
+const loadChargingStations = (renderCallback?: () => void): void => {
   if (state.loading === false) {
     state.loading = true
     uiClient
@@ -105,8 +105,8 @@ const loadChargingStations = (reloadCallback?: () => void): void => {
         console.error('Error at fetching charging stations:', error)
       })
       .finally(() => {
-        if (reloadCallback != null) {
-          reloadCallback()
+        if (renderCallback != null) {
+          renderCallback()
         }
         state.loading = false
       })