2
0
mirror of https://github.com/frappe/books.git synced 2025-02-09 07:29:07 +00:00
books/src/main.js

64 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-06-01 18:05:51 +05:30
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
// vue imports
2018-06-01 18:05:51 +05:30
import Vue from 'vue'
import App from './App'
import router from './router'
// frappejs imports
import frappe from 'frappejs';
import HTTPClient from 'frappejs/backends/http';
import Observable from 'frappejs/utils/observable';
import common from 'frappejs/common';
import coreModels from 'frappejs/models';
import models from '../models';
import io from 'socket.io-client';
// vue components
2018-06-01 18:05:51 +05:30
import NotFound from './components/NotFound';
2018-06-04 14:58:45 +05:30
import FeatherIcon from './components/FeatherIcon';
import FrappeControl from './components/controls/FrappeControl';
import Button from './components/Button';
import Indicator from './components/Indicator';
frappe.init();
frappe.registerLibs(common);
frappe.registerModels(coreModels);
frappe.registerModels(models);
const server = 'localhost:8000';
frappe.fetch = window.fetch.bind();
frappe.db = new HTTPClient({ server });
const socket = io.connect(`http://${server}`);
frappe.db.bindSocketClient(socket);
frappe.registerModels(models);
frappe.docs = new Observable();
frappe.getSingle('SystemSettings');
frappe.getSingle('AccountingSettings')
.then(accountingSettings => {
if (accountingSettings.companyName) {
router.push('/list/ToDo');
} else {
router.push('/setup-wizard');
}
});
window.frappe = frappe;
2018-06-01 18:05:51 +05:30
Vue.config.productionTip = false
Vue.component('not-found', NotFound);
2018-06-04 14:58:45 +05:30
Vue.component('feather-icon', FeatherIcon);
Vue.component('frappe-control', FrappeControl);
Vue.component('f-button', Button);
Vue.component('indicator', Indicator);
2018-06-01 18:05:51 +05:30
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})