2018-01-09 17:52:26 +01:00
|
|
|
// The Vue build version to load with the `import` command
|
|
|
|
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
|
|
|
import Vue from 'vue';
|
|
|
|
// import * as VueGoogleMaps from 'vue2-google-maps';
|
|
|
|
import VueMarkdown from 'vue-markdown';
|
2018-05-18 11:28:29 +02:00
|
|
|
import VuetifyGoogleAutocomplete from 'vuetify-google-autocomplete';
|
2018-01-09 17:52:26 +01:00
|
|
|
import Vuetify from 'vuetify';
|
|
|
|
import Vuex from 'vuex';
|
|
|
|
import moment from 'moment';
|
|
|
|
import VuexI18n from 'vuex-i18n';
|
|
|
|
import 'vuetify/dist/vuetify.min.css';
|
2018-05-18 11:28:29 +02:00
|
|
|
import 'material-design-icons-iconfont/dist/material-design-icons.css';
|
2018-01-09 17:52:26 +01:00
|
|
|
import App from '@/App';
|
|
|
|
import router from '@/router';
|
2018-01-13 23:33:03 +01:00
|
|
|
import storeData from '@/store/index';
|
|
|
|
import translations from '@/i18n/index';
|
|
|
|
import auth from '@/auth';
|
2018-01-09 17:52:26 +01:00
|
|
|
|
|
|
|
Vue.config.productionTip = false;
|
|
|
|
|
2018-05-18 11:28:29 +02:00
|
|
|
Vue.use(VuetifyGoogleAutocomplete, {
|
|
|
|
apiKey: 'AIzaSyBF37pw38j0giICt73TCAPNogc07Upe_Q4', // Can also be an object. E.g, for Google Maps Premium API, pass `{ client: <YOUR-CLIENT-ID> }`
|
|
|
|
});
|
|
|
|
|
2018-01-09 17:52:26 +01:00
|
|
|
/*Vue.use(VueGoogleMaps, {
|
|
|
|
load: {
|
|
|
|
key: 'AIzaSyBF37pw38j0giICt73TCAPNogc07Upe_Q4',
|
|
|
|
libraries: 'places',
|
|
|
|
installComponents: false,
|
|
|
|
},
|
|
|
|
});*/
|
|
|
|
|
|
|
|
Vue.use(VueMarkdown);
|
|
|
|
Vue.use(Vuetify);
|
|
|
|
Vue.use(Vuex);
|
|
|
|
let language = window.navigator.userLanguage || window.navigator.language;
|
|
|
|
moment.locale(language);
|
|
|
|
|
|
|
|
Vue.filter('formatDate', value => (value ? moment(String(value)).format('LLLL') : null));
|
|
|
|
|
|
|
|
if (!(language in translations)) {
|
|
|
|
[language] = language.split('-', 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
const store = new Vuex.Store(storeData);
|
|
|
|
|
|
|
|
Vue.use(VuexI18n.plugin, store);
|
|
|
|
|
|
|
|
Object.entries(translations).forEach((key) => {
|
|
|
|
Vue.i18n.add(key[0], key[1]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Vue.i18n.set(language);
|
|
|
|
Vue.i18n.fallback('en');
|
|
|
|
|
2018-01-13 23:33:03 +01:00
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
if (to.matched.some(record => record.meta.requiredAuth) && store.state.user === undefined || store.state.user == null) {
|
|
|
|
next({
|
|
|
|
name: 'Login',
|
|
|
|
query: { redirect: to.fullPath }
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
auth.getUser(store, () => {}, () => {});
|
|
|
|
|
2018-01-09 17:52:26 +01:00
|
|
|
/* eslint-disable no-new */
|
|
|
|
new Vue({
|
|
|
|
el: '#app',
|
|
|
|
router,
|
|
|
|
store,
|
|
|
|
template: '<App/>',
|
|
|
|
components: { App },
|
|
|
|
});
|