mirror of
https://github.com/filegator/filegator.git
synced 2025-10-24 16:26:20 +02:00
initial commit
This commit is contained in:
64
frontend/main.js
Normal file
64
frontend/main.js
Normal file
@@ -0,0 +1,64 @@
|
||||
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'
|
||||
import '@fortawesome/fontawesome-free/css/all.css'
|
||||
import '@fortawesome/fontawesome-free/css/fontawesome.css'
|
||||
|
||||
//TODO: import './registerServiceWorker'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.config.baseURL =
|
||||
process.env.VUE_APP_API_ENDPOINT
|
||||
? process.env.VUE_APP_API_ENDPOINT
|
||||
: window.location.origin+window.location.pathname+'?r='
|
||||
|
||||
axios.defaults.withCredentials = true
|
||||
axios.defaults.baseURL = Vue.config.baseURL
|
||||
|
||||
axios.defaults.headers['Content-Type'] = 'application/json'
|
||||
|
||||
Vue.use(Buefy, {
|
||||
defaultIconPack: 'fas',
|
||||
})
|
||||
|
||||
Vue.mixin(shared)
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: h => h(App),
|
||||
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)
|
||||
this.$router.push('/')
|
||||
})
|
||||
.catch(error => {
|
||||
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,
|
||||
})
|
||||
})
|
||||
},
|
||||
}).$mount('#app')
|
||||
Reference in New Issue
Block a user