Added global api config (#31)

This commit is contained in:
konrad 2019-09-09 17:32:57 +00:00 committed by Gitea
parent 78272ae4cd
commit 857c283fb7
2 changed files with 23 additions and 2 deletions

16
src/config.js Normal file
View File

@ -0,0 +1,16 @@
import {HTTP} from './http-common'
export default {
config: null,
getConfig() {
return this.config
},
initConfig() {
return HTTP.get('info')
.then(r => {
this.config = r.data
})
}
}

View File

@ -20,6 +20,12 @@ Vue.config.productionTip = false
import Notifications from 'vue-notification'
Vue.use(Notifications)
import config from './config'
config.initConfig()
.then(() => {
Vue.prototype.$config = config.getConfig()
})
// Icons
import { library } from '@fortawesome/fontawesome-svg-core'
import { faSignOutAlt } from '@fortawesome/free-solid-svg-icons'
@ -88,11 +94,10 @@ Vue.directive('focus', {
}
})
// Check the user's auth status when the app starts
auth.checkAuth()
new Vue({
router,
render: h => h(App)
render: h => h(App)
}).$mount('#app')