bce88243188951771f87f1b3bade16661a3411b6
1 import { createApp
} from
'vue'
2 import type { ConfigurationData
, ResponsePayload
} from
'./types'
3 import { router
} from
'@/router'
4 import { UIClient
} from
'@/composables'
5 import App from
'@/App.vue'
7 const initializeApp
= (config
: ConfigurationData
) => {
8 const app
= createApp(App
)
9 app
.config
.errorHandler
= (error
, instance
, info
) => {
10 console
.error('Error:', error
)
11 console
.info('Vue instance:', instance
)
12 console
.info('Error info:', info
)
13 // TODO: Add code for UI notifications or other error handling logic
15 app
.config
.globalProperties
.$uiClient
= UIClient
.getInstance(config
)
16 app
.config
.globalProperties
.$uiClient
.registerWSonOpenListener(() => {
17 app
.config
.globalProperties
.$uiClient
18 .listChargingStations()
19 .then((response
: ResponsePayload
) => {
20 app
.config
.globalProperties
.$chargingStations
= response
.chargingStations
22 .catch((error
: Error) => {
23 console
.error('Error at fetching charging stations:', error
)
27 app
.use(router
).mount('#app')
33 .then(response
=> response
.json())
35 console
.error('Error at fetching app configuration:', error
)
42 console
.error('Error at initializing app:', error
)