</Button>
<ReloadButton
id="reload-button"
- :loading="state.isLoading"
- @click="loadChargingStations(() => $router.go(0))"
+ :loading="state.loading"
+ @click="loadChargingStations(() => (state.reload = randomUUID()))"
/>
</Container>
<CSTable
Array.isArray(app?.appContext.config.globalProperties.$chargingStations) &&
app?.appContext.config.globalProperties.$chargingStations.length > 0
"
+ :key="state.reload"
:charging-stations="app?.appContext.config.globalProperties.$chargingStations"
/>
</Container>
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<number>('uiServerConfigurationIndex', 0)
})
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) => {
if (reloadCallback != null) {
reloadCallback()
}
- state.isLoading = false
+ state.loading = false
})
}
}