70 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-06-13 18:52:40 +02:00
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Buefy from 'buefy'
import shared from './mixins/shared'
import axios from 'axios'
import api from './api/api'
2020-02-21 13:04:34 +01:00
import VueLazyload from 'vue-lazyload'
2019-06-13 18:52:40 +02:00
import '@fortawesome/fontawesome-free/css/all.css'
import '@fortawesome/fontawesome-free/css/fontawesome.css'
//TODO: import './registerServiceWorker'
Vue.config.productionTip = false
2019-06-26 10:54:38 +02:00
/* eslint-disable-next-line */
Vue.config.baseURL = process.env.VUE_APP_API_ENDPOINT ? process.env.VUE_APP_API_ENDPOINT : window.location.origin+window.location.pathname+'?r='
2019-06-13 18:52:40 +02:00
axios.defaults.withCredentials = true
axios.defaults.baseURL = Vue.config.baseURL
axios.defaults.headers['Content-Type'] = 'application/json'
Vue.use(Buefy, {
defaultIconPack: 'fas',
})
2020-02-21 13:04:34 +01:00
Vue.use(VueLazyload, {
preLoad: 1.3,
})
2019-06-13 18:52:40 +02:00
Vue.mixin(shared)
new Vue({
router,
store,
created: function() {
api.getConfig()
.then(ret => {
this.$store.commit('setConfig', ret.data.data)
api.getUser()
.then((user) => {
this.$store.commit('initialize')
this.$store.commit('setUser', user)
2020-05-17 17:29:10 +02:00
this.$router.push('/').catch(() => {})
2019-06-13 18:52:40 +02:00
})
2019-06-25 16:22:11 +02:00
.catch(() => {
2019-06-13 18:52:40 +02:00
this.$notification.open({
message: this.lang('Something went wrong'),
type: 'is-danger',
queue: false,
indefinite: true,
})
})
})
.catch(() => {
this.$notification.open({
message: this.lang('Something went wrong'),
type: 'is-danger',
queue: false,
indefinite: true,
})
})
},
2019-06-26 10:54:38 +02:00
render: h => h(App),
2019-06-13 18:52:40 +02:00
}).$mount('#app')