75 lines
1.4 KiB
JavaScript
75 lines
1.4 KiB
JavaScript
import './index.css'
|
|
|
|
import { createApp } from 'vue'
|
|
import router from './router'
|
|
import App from './App.vue'
|
|
import { createPinia } from 'pinia'
|
|
|
|
import {
|
|
FrappeUI,
|
|
Button,
|
|
Input,
|
|
TextInput,
|
|
FormControl,
|
|
ErrorMessage,
|
|
Dialog,
|
|
Alert,
|
|
Badge,
|
|
setConfig,
|
|
frappeRequest,
|
|
FeatherIcon,
|
|
} from 'frappe-ui'
|
|
import translationPlugin from './translation'
|
|
import { createDialog } from './utils/dialogs'
|
|
import { initSocket } from './socket'
|
|
|
|
let globalComponents = {
|
|
Button,
|
|
TextInput,
|
|
Input,
|
|
FormControl,
|
|
ErrorMessage,
|
|
Dialog,
|
|
Alert,
|
|
Badge,
|
|
FeatherIcon,
|
|
}
|
|
|
|
// create a pinia instance
|
|
let pinia = createPinia()
|
|
|
|
let app = createApp(App)
|
|
|
|
setConfig('resourceFetcher', frappeRequest)
|
|
app.use(FrappeUI)
|
|
app.use(pinia)
|
|
app.use(router)
|
|
app.use(translationPlugin)
|
|
for (let key in globalComponents) {
|
|
app.component(key, globalComponents[key])
|
|
}
|
|
|
|
app.config.globalProperties.$dialog = createDialog
|
|
|
|
let socket
|
|
if (import.meta.env.DEV) {
|
|
frappeRequest({ url: '/api/method/crm.www.crm.get_context_for_dev' }).then(
|
|
(values) => {
|
|
for (let key in values) {
|
|
window[key] = values[key]
|
|
}
|
|
socket = initSocket()
|
|
app.config.globalProperties.$socket = socket
|
|
app.mount('#app')
|
|
}
|
|
)
|
|
} else {
|
|
socket = initSocket()
|
|
app.config.globalProperties.$socket = socket
|
|
app.mount('#app')
|
|
}
|
|
|
|
if (import.meta.env.DEV) {
|
|
window.$dialog = createDialog
|
|
}
|