repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor(ui): use bootstrap theme for toast notifications
[e-mobility-charging-stations-simulator.git]
/
ui
/
web
/
src
/
components
/
actions
/
AddChargingStations.vue
diff --git
a/ui/web/src/components/actions/AddChargingStations.vue
b/ui/web/src/components/actions/AddChargingStations.vue
index 164518b1f70e7fd8590d1b9b6dc1ab63998f4da9..7a2f8a59ef86cc8c727a5f587c7cbd5e55558557 100644
(file)
--- a/
ui/web/src/components/actions/AddChargingStations.vue
+++ b/
ui/web/src/components/actions/AddChargingStations.vue
@@
-11,7
+11,7
@@
id="number-of-stations"
v-model="state.numberOfStations"
type="text"
id="number-of-stations"
v-model="state.numberOfStations"
type="text"
- name="number-of-station"
+ name="number-of-station
s
"
placeholder="number of stations"
/>
<br />
placeholder="number of stations"
/>
<br />
@@
-20,8
+20,11
@@
() => {
uiClient
.addChargingStations(state.template, state.numberOfStations)
() => {
uiClient
.addChargingStations(state.template, state.numberOfStations)
+ .then(() => {
+ $toast.success('Charging stations successfully added')
+ })
.catch((error: Error) => {
.catch((error: Error) => {
- // TODO: add code for UI notifications or other error handling logic
+ $toast.error('Error at adding charging stations')
console.error('Error at adding charging stations:', error)
})
.finally(() => {
console.error('Error at adding charging stations:', error)
})
.finally(() => {
@@
-36,7
+39,9
@@
<script setup lang="ts">
import { getCurrentInstance, onMounted, reactive } from 'vue'
<script setup lang="ts">
import { getCurrentInstance, onMounted, reactive } from 'vue'
+import { useToast } from 'vue-toast-notification'
import Button from '@/components/buttons/Button.vue'
import Button from '@/components/buttons/Button.vue'
+import type { ResponsePayload } from '@/types'
const state = reactive({
ready: false,
const state = reactive({
ready: false,
@@
-47,6
+52,8
@@
const state = reactive({
const app = getCurrentInstance()
const uiClient = app?.appContext.config.globalProperties.$uiClient
const app = getCurrentInstance()
const uiClient = app?.appContext.config.globalProperties.$uiClient
+const $toast = useToast()
+
onMounted(() => {
uiClient
.listTemplates()
onMounted(() => {
uiClient
.listTemplates()
@@
-56,7
+63,7
@@
onMounted(() => {
}
})
.catch((error: Error) => {
}
})
.catch((error: Error) => {
- // TODO: add code for UI notifications or other error handling logic
+ $toast.error('Error at fetching charging station templates')
console.error('Error at fetching charging station templates:', error)
})
.finally(() => {
console.error('Error at fetching charging station templates:', error)
})
.finally(() => {