2017-01-15 19:49:15 +00:00
|
|
|
// TODO verify if it's needed, added because Axios require Promise in the global scope
|
2016-09-20 16:58:02 +00:00
|
|
|
// and babel-runtime doesn't affect external libraries
|
|
|
|
|
require('babel-polyfill');
|
|
|
|
|
|
2016-09-18 19:51:20 +00:00
|
|
|
import Vue from 'vue';
|
2017-01-15 19:49:15 +00:00
|
|
|
import axios from 'axios';
|
2016-09-29 11:32:36 +00:00
|
|
|
import AppComponent from './app';
|
2016-09-18 19:51:20 +00:00
|
|
|
import router from './router';
|
2017-03-18 17:33:08 +00:00
|
|
|
import generateStore from './store';
|
|
|
|
|
import StoreModule from './libs/store';
|
2016-12-07 02:27:49 +00:00
|
|
|
import './filters/registerGlobals';
|
2017-03-18 17:33:08 +00:00
|
|
|
import i18n from './libs/i18n';
|
2017-01-14 20:12:11 +00:00
|
|
|
|
2017-03-11 18:42:50 +00:00
|
|
|
const IS_PRODUCTION = process.env.NODE_ENV === 'production'; // eslint-disable-line no-process-env
|
|
|
|
|
|
|
|
|
|
// Configure Vue global options, see https://vuejs.org/v2/api/#Global-Config
|
|
|
|
|
|
|
|
|
|
// Enable perf timeline measuring for Vue components in Chrome Dev Tools
|
|
|
|
|
// Note: this has been disabled because it caused some perf issues
|
|
|
|
|
// if rendering becomes too slow in dev mode, we should turn it off
|
|
|
|
|
// See https://github.com/vuejs/vue/issues/5174
|
|
|
|
|
Vue.config.performance = !IS_PRODUCTION;
|
|
|
|
|
// Disable annoying reminder abour production build in dev mode
|
|
|
|
|
Vue.config.productionTip = IS_PRODUCTION;
|
|
|
|
|
|
2017-01-14 20:12:11 +00:00
|
|
|
Vue.use(i18n);
|
2017-03-18 17:33:08 +00:00
|
|
|
Vue.use(StoreModule);
|
2016-09-23 20:39:06 +00:00
|
|
|
|
2017-03-18 17:33:08 +00:00
|
|
|
// TODO just until we have proper authentication
|
2016-09-23 20:39:06 +00:00
|
|
|
let authSettings = localStorage.getItem('habit-mobile-settings');
|
|
|
|
|
|
|
|
|
|
if (authSettings) {
|
|
|
|
|
authSettings = JSON.parse(authSettings);
|
2017-01-15 19:49:15 +00:00
|
|
|
axios.defaults.headers.common['x-api-user'] = authSettings.auth.apiId;
|
|
|
|
|
axios.defaults.headers.common['x-api-key'] = authSettings.auth.apiToken;
|
2016-09-23 20:39:06 +00:00
|
|
|
}
|
2016-09-23 17:49:11 +00:00
|
|
|
|
2017-03-18 17:33:08 +00:00
|
|
|
export default new Vue({
|
2017-06-28 03:53:59 +00:00
|
|
|
el: '#app',
|
2016-09-18 19:51:20 +00:00
|
|
|
router,
|
2017-03-18 17:33:08 +00:00
|
|
|
store: generateStore(),
|
2016-09-23 17:49:11 +00:00
|
|
|
render: h => h(AppComponent),
|
2017-06-28 03:53:59 +00:00
|
|
|
});
|