fix(ui): fix charging stations refresh
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / actions / AddChargingStations.vue
CommitLineData
7086aac2
JB
1<template>
2 <h2>Action Add Charging Stations</h2>
3</template>
4
5<script setup lang="ts">
6import { getCurrentInstance, onMounted } from 'vue'
7
8const app = getCurrentInstance()
9const uiClient = app?.appContext.config.globalProperties.$uiClient
10
11onMounted(() => {
b9d447d2
JB
12 uiClient
13 .listTemplates()
14 .then((response: ResponsePayload) => {
15 if (app != null && app.appContext.config.globalProperties.$templates == null) {
16 app.appContext.config.globalProperties.$templates = response.templates
17 }
18 })
19 .catch((error: Error) => {
20 // TODO: add code for UI notifications or other error handling logic
21 console.error('Error at fetching charging station templates:', error)
22 })
7086aac2
JB
23})
24</script>
25
26<style></style>