gamebrary/src/main.js

72 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-10-19 05:15:28 +00:00
import Vue from 'vue';
import VueAxios from 'vue-axios';
import VueFire from 'vuefire';
2018-10-19 05:15:28 +00:00
import VueI18n from 'vue-i18n';
import axios from 'axios';
2018-11-05 02:28:29 +00:00
import VueAnalytics from 'vue-analytics';
2018-11-08 03:41:27 +00:00
import Raven from 'raven-js';
import RavenVue from 'raven-js/plugins/vue';
import VueShortKey from 'vue-shortkey';
2018-10-19 05:15:28 +00:00
import App from './App';
2018-12-19 16:30:09 +00:00
import messages from './i18n/';
2019-06-18 21:09:28 +00:00
import router from './router/';
import store from './store/';
2018-10-19 05:15:28 +00:00
const EventBus = new Vue();
Object.defineProperties(Vue.prototype, {
$bus: {
get() {
return EventBus;
},
},
});
2018-11-05 02:28:29 +00:00
Vue.use(VueAnalytics, {
id: 'UA-120053966-1',
router,
});
Vue.use(VueAxios, axios);
Vue.use(VueFire);
Vue.use(VueI18n);
Vue.use(VueShortKey, { prevent: ['input', 'textarea'] });
2018-10-19 05:15:28 +00:00
2018-11-08 03:41:27 +00:00
if (process.env.NODE_ENV !== 'development') {
Raven
.config('https://15928bc58e7b45ac93878da6d8146064@sentry.io/1315568')
.addPlugin(RavenVue, Vue)
.install();
}
2018-10-19 05:15:28 +00:00
Vue.config.productionTip = false;
router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth && !store.getters.auth) {
next('/');
} else {
2018-11-05 02:27:14 +00:00
if (to.meta && to.meta.title) {
document.title = `${to.meta.title} - Gamebrary`;
}
2018-10-19 05:15:28 +00:00
next();
}
});
2019-05-18 14:21:40 +00:00
// console.log(JSON.parse(localStorage.vuex).settings.language);
2018-10-19 05:15:28 +00:00
const i18n = new VueI18n({
locale: 'en',
messages,
});
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
i18n,
store,
components: { App },
template: '<App/>',
});