2019-10-20 08:04:19 +00:00
|
|
|
import '@babel/polyfill';
|
|
|
|
|
2019-08-14 09:48:44 +00:00
|
|
|
/* eslint no-console: 0 */
|
|
|
|
/* eslint-env browser */
|
|
|
|
/* eslint-disable no-new */
|
|
|
|
/* Vue Core */
|
|
|
|
|
|
|
|
import Vue from 'vue';
|
|
|
|
import VueI18n from 'vue-i18n';
|
|
|
|
import VueRouter from 'vue-router';
|
|
|
|
import axios from 'axios';
|
|
|
|
// Global Components
|
|
|
|
import Multiselect from 'vue-multiselect';
|
|
|
|
import WootSwitch from 'components/ui/Switch';
|
|
|
|
import WootWizard from 'components/ui/Wizard';
|
|
|
|
import { sync } from 'vuex-router-sync';
|
|
|
|
import Vuelidate from 'vuelidate';
|
|
|
|
import VTooltip from 'v-tooltip';
|
|
|
|
|
2019-10-16 09:06:17 +00:00
|
|
|
import WootUiKit from '../dashboard/components';
|
|
|
|
import App from '../dashboard/App';
|
|
|
|
import i18n from '../dashboard/i18n';
|
|
|
|
import createAxios from '../dashboard/helper/APIHelper';
|
|
|
|
import commonHelpers from '../dashboard/helper/commons';
|
|
|
|
import router from '../dashboard/routes';
|
|
|
|
import store from '../dashboard/store';
|
2019-10-24 20:07:01 +00:00
|
|
|
import vueActionCable from '../dashboard/helper/actionCable';
|
2019-10-16 09:06:17 +00:00
|
|
|
import constants from '../dashboard/constants';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
Vue.config.env = process.env;
|
|
|
|
|
|
|
|
Vue.use(VueRouter);
|
|
|
|
Vue.use(VueI18n);
|
|
|
|
Vue.use(WootUiKit);
|
|
|
|
Vue.use(Vuelidate);
|
|
|
|
Vue.use(VTooltip);
|
|
|
|
|
|
|
|
Vue.component('multiselect', Multiselect);
|
|
|
|
Vue.component('woot-switch', WootSwitch);
|
|
|
|
Vue.component('woot-wizard', WootWizard);
|
|
|
|
|
2019-08-21 04:57:57 +00:00
|
|
|
Object.keys(i18n).forEach(lang => {
|
2019-08-14 09:48:44 +00:00
|
|
|
Vue.locale(lang, i18n[lang]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Vue.config.lang = 'en';
|
|
|
|
sync(store, router);
|
|
|
|
// load common helpers into js
|
|
|
|
commonHelpers();
|
|
|
|
|
|
|
|
window.WootConstants = constants;
|
|
|
|
window.axios = createAxios(axios);
|
|
|
|
window.bus = new Vue();
|
2019-08-21 04:57:57 +00:00
|
|
|
window.onload = () => {
|
2019-08-14 09:48:44 +00:00
|
|
|
window.WOOT = new Vue({
|
|
|
|
router,
|
|
|
|
store,
|
|
|
|
components: { App },
|
2019-08-25 05:34:33 +00:00
|
|
|
template: '<App/>',
|
2019-08-14 09:48:44 +00:00
|
|
|
}).$mount('#app');
|
2019-10-24 20:07:01 +00:00
|
|
|
vueActionCable.init();
|
2019-08-21 04:57:57 +00:00
|
|
|
};
|
2019-10-18 07:07:09 +00:00
|
|
|
|
|
|
|
if ('serviceWorker' in navigator) {
|
|
|
|
window.addEventListener('load', () => {
|
|
|
|
navigator.serviceWorker
|
|
|
|
.register('/sw.js')
|
|
|
|
.then(registration => {
|
|
|
|
console.log('SW registered: ', registration);
|
|
|
|
})
|
|
|
|
.catch(registrationError => {
|
|
|
|
console.log('SW registration failed: ', registrationError);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|