From: Jérôme Benoit Date: Tue, 27 Feb 2024 00:24:38 +0000 (+0100) Subject: fix(ui): re-render charging stations table without reloading X-Git-Tag: v1.2.38~36 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a4868fd7e236faf73e62efeeadad20119e2d96eb;p=e-mobility-charging-stations-simulator.git fix(ui): re-render charging stations table without reloading Signed-off-by: Jérôme Benoit --- diff --git a/ui/web/src/views/ChargingStationsView.vue b/ui/web/src/views/ChargingStationsView.vue index cb8d607d..18b0cc02 100644 --- a/ui/web/src/views/ChargingStationsView.vue +++ b/ui/web/src/views/ChargingStationsView.vue @@ -43,8 +43,8 @@ 0 " + :key="state.reload" :charging-stations="app?.appContext.config.globalProperties.$chargingStations" /> @@ -67,8 +68,13 @@ import ReloadButton from '@/components/buttons/ReloadButton.vue' import Button from '@/components/buttons/Button.vue' import { getFromLocalStorage, setToLocalStorage } from '@/composables' +const randomUUID = (): `${string}-${string}-${string}-${string}-${string}` => { + return crypto.randomUUID() +} + const state = reactive({ - isLoading: false, + loading: false, + reload: randomUUID(), uiServerIndex: getFromLocalStorage('uiServerConfigurationIndex', 0) }) @@ -85,8 +91,8 @@ const uiServerConfigurations: { configuration: UIServerConfigurationSection; ind const $toast = useToast() const loadChargingStations = (reloadCallback?: () => void): void => { - if (state.isLoading === false) { - state.isLoading = true + if (state.loading === false) { + state.loading = true uiClient .listChargingStations() .then((response: ResponsePayload) => { @@ -102,7 +108,7 @@ const loadChargingStations = (reloadCallback?: () => void): void => { if (reloadCallback != null) { reloadCallback() } - state.isLoading = false + state.loading = false }) } }