import { createApp } from 'vue'
+import ToastPlugin from 'vue-toast-notification'
import type { ConfigurationData, ResponsePayload } from './types'
import { router } from '@/router'
import { UIClient } from '@/composables'
import App from '@/App.vue'
+import 'vue-toast-notification/dist/theme-bootstrap.css'
const initializeApp = (config: ConfigurationData) => {
const app = createApp(App)
console.error('Error:', error)
console.info('Vue instance:', instance)
console.info('Error info:', info)
- // TODO: Add code for UI notifications or other error handling logic
+ // TODO: add code for UI notifications or other error handling logic
}
- app.config.globalProperties.$uiClient = UIClient.getInstance(config)
- app.config.globalProperties.$uiClient.registerWSonOpenListener(async () => {
+ app.config.globalProperties.$uiClient = UIClient.getInstance(config.uiServer)
+ app.config.globalProperties.$uiClient.registerWSEventListener('open', () => {
app.config.globalProperties.$uiClient
.listChargingStations()
.then((response: ResponsePayload) => {
app.config.globalProperties.$chargingStations = response.chargingStations
})
.catch((error: Error) => {
+ // TODO: add code for UI notifications or other error handling logic
console.error('Error at fetching charging stations:', error)
throw error
})
.finally(() => {
- app.use(router).mount('#app')
+ app.use(router).use(ToastPlugin).mount('#app')
})
})
}