2 <h2>Action Add Charging Stations</h2>
4 <select v-if="state.ready" v-model="state.template">
5 <option v-for="template in app?.appContext.config.globalProperties.$templates">
9 <p>Number of stations:</p>
11 id="number-of-stations"
12 v-model="state.numberOfStations"
14 name="number-of-station"
15 placeholder="number of stations"
22 .addChargingStations(state.template, state.numberOfStations)
23 .catch((error: Error) => {
24 // TODO: add code for UI notifications or other error handling logic
25 console.error('Error at adding charging stations:', error)
28 $router.push({ name: 'charging-stations' })
32 >Add Charging Stations</Button
34 <Button @click="$router.push({ name: 'charging-stations' })">Cancel</Button>
37 <script setup lang="ts">
38 import { getCurrentInstance, onMounted, reactive } from 'vue'
39 import Button from '@/components/buttons/Button.vue'
41 const state = reactive({
47 const app = getCurrentInstance()
48 const uiClient = app?.appContext.config.globalProperties.$uiClient
53 .then((response: ResponsePayload) => {
54 if (app != null && app.appContext.config.globalProperties.$templates == null) {
55 app.appContext.config.globalProperties.$templates = response.templates
58 .catch((error: Error) => {
59 // TODO: add code for UI notifications or other error handling logic
60 console.error('Error at fetching charging station templates:', error)