2018-10-19 05:15:28 +00:00
|
|
|
import Vue from 'vue';
|
2020-08-15 00:02:34 +00:00
|
|
|
// TODO: Cherry pick components and icon to reduce bundle size
|
2020-08-11 23:39:11 +00:00
|
|
|
import { BootstrapVue, BootstrapVueIcons } from 'bootstrap-vue';
|
2018-10-25 06:33:15 +00:00
|
|
|
import VueAxios from 'vue-axios';
|
|
|
|
import VueFire from 'vuefire';
|
2018-10-19 05:15:28 +00:00
|
|
|
import VueI18n from 'vue-i18n';
|
2018-10-25 06:33:15 +00:00
|
|
|
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';
|
2020-08-15 00:02:34 +00:00
|
|
|
// is this needed?
|
2020-07-21 20:47:12 +00:00
|
|
|
import 'bootstrap/dist/css/bootstrap.css';
|
|
|
|
import 'bootstrap-vue/dist/bootstrap-vue.css';
|
2020-08-11 23:39:11 +00:00
|
|
|
import 'bootstrap-vue/dist/bootstrap-vue-icons.min.css';
|
2018-10-19 05:15:28 +00:00
|
|
|
import App from './App';
|
2018-12-19 16:30:09 +00:00
|
|
|
import messages from './i18n/';
|
2018-10-25 06:33:15 +00:00
|
|
|
import store from './store/';
|
2019-08-06 22:45:59 +00:00
|
|
|
import router from './router';
|
2018-10-19 05:15:28 +00:00
|
|
|
|
|
|
|
const EventBus = new Vue();
|
|
|
|
|
|
|
|
Object.defineProperties(Vue.prototype, {
|
2019-11-08 19:56:03 +00:00
|
|
|
$bus: {
|
|
|
|
get() {
|
|
|
|
return EventBus;
|
2018-10-19 05:15:28 +00:00
|
|
|
},
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
2018-10-19 05:15:28 +00:00
|
|
|
});
|
|
|
|
|
2020-08-11 23:39:11 +00:00
|
|
|
Vue.use(BootstrapVue, {
|
|
|
|
BToast: {
|
|
|
|
autoHideDelay: 500,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
Vue.use(BootstrapVueIcons);
|
2019-06-18 21:15:14 +00:00
|
|
|
Vue.use(VueAnalytics, { id: 'UA-120053966-1', router });
|
2018-10-25 06:33:15 +00:00
|
|
|
Vue.use(VueAxios, axios);
|
|
|
|
Vue.use(VueFire);
|
|
|
|
Vue.use(VueI18n);
|
2018-10-19 05:15:28 +00:00
|
|
|
|
2018-11-08 03:41:27 +00:00
|
|
|
if (process.env.NODE_ENV !== 'development') {
|
2019-11-08 19:56:03 +00:00
|
|
|
Raven
|
|
|
|
.config('https://15928bc58e7b45ac93878da6d8146064@sentry.io/1315568')
|
|
|
|
.addPlugin(RavenVue, Vue)
|
|
|
|
.install();
|
2018-11-08 03:41:27 +00:00
|
|
|
}
|
|
|
|
|
2018-10-19 05:15:28 +00:00
|
|
|
Vue.config.productionTip = false;
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
2019-11-08 19:56:03 +00:00
|
|
|
if (to.meta.requiresAuth && !store.getters.auth) {
|
|
|
|
next('/');
|
|
|
|
} else {
|
|
|
|
if (to.meta && to.meta.title) {
|
|
|
|
document.title = `${to.meta.title} - Gamebrary`;
|
2018-10-19 05:15:28 +00:00
|
|
|
}
|
2019-11-08 19:56:03 +00:00
|
|
|
|
|
|
|
next();
|
|
|
|
}
|
2018-10-19 05:15:28 +00:00
|
|
|
});
|
|
|
|
|
2019-06-22 12:43:51 +00:00
|
|
|
const vuexStorage = localStorage && localStorage.vuex
|
2019-11-08 19:56:03 +00:00
|
|
|
? JSON.parse(localStorage.vuex)
|
|
|
|
: null;
|
2019-06-22 12:43:51 +00:00
|
|
|
|
2019-06-25 17:58:06 +00:00
|
|
|
if (vuexStorage && vuexStorage.user && window.FS && window.location.origin.indexOf('localhost') === -1) {
|
2019-11-08 19:56:03 +00:00
|
|
|
const { displayName, email, dateJoined } = vuexStorage.user;
|
2019-06-25 17:58:06 +00:00
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
window.FS.identify(vuexStorage.user.uid, { displayName, email, dateJoined });
|
2019-06-25 17:58:06 +00:00
|
|
|
}
|
|
|
|
|
2019-06-22 12:58:38 +00:00
|
|
|
const locale = vuexStorage && vuexStorage.settings && vuexStorage.settings.language
|
2019-11-08 19:56:03 +00:00
|
|
|
? vuexStorage.settings.language
|
|
|
|
: 'en';
|
2019-05-18 14:21:40 +00:00
|
|
|
|
2019-06-18 23:46:29 +00:00
|
|
|
const i18n = new VueI18n({ locale, messages });
|
2018-10-19 05:15:28 +00:00
|
|
|
|
|
|
|
/* eslint-disable no-new */
|
|
|
|
new Vue({
|
2019-11-08 19:56:03 +00:00
|
|
|
el: '#app',
|
|
|
|
router,
|
|
|
|
i18n,
|
|
|
|
store,
|
|
|
|
components: { App },
|
|
|
|
template: '<App/>',
|
2018-10-19 05:15:28 +00:00
|
|
|
});
|
2019-11-08 20:34:06 +00:00
|
|
|
|