2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/src/main-electron.js

54 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-10-20 12:32:01 +00:00
// vue imports
import Vue from 'vue';
import App from './App';
import router from './router';
import frappeVue from 'frappejs/ui/plugins/frappeVue';
// frappejs imports
import frappe from 'frappejs';
import SQLite from 'frappejs/backends/sqlite';
import common from 'frappejs/common';
import coreModels from 'frappejs/models';
import models from '../models';
2018-10-21 12:49:33 +00:00
import registerServerMethods from '../server/registerServerMethods';
(async () => {
frappe.isServer = true;
frappe.init();
frappe.registerLibs(common);
frappe.registerModels(coreModels);
frappe.registerModels(models);
frappe.fetch = window.fetch.bind();
frappe.login('Administrator');
frappe.db = new SQLite({ dbPath: 'test.db' });
await frappe.db.connect();
await frappe.db.migrate();
frappe.getSingle('SystemSettings');
registerServerMethods();
frappe.getSingle('AccountingSettings')
.then(accountingSettings => {
if (router.currentRoute.fullPath !== '/') return;
if (accountingSettings.companyName) {
router.push('/tree/Account');
} else {
router.push('/setup-wizard');
}
});
window.frappe = frappe;
Vue.config.productionTip = false;
Vue.use(frappeVue);
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
2018-10-20 12:32:01 +00:00
});
2018-10-21 12:49:33 +00:00
})()