Added somewhat global config

This commit is contained in:
kolaente 2019-09-09 20:47:43 +02:00
parent 568de04a87
commit d92c3ae272
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 19 additions and 7 deletions

View File

@ -1,5 +1,6 @@
<template>
<div id="app">
<template v-if="appReady">
<nav class="navbar main-theme is-fixed-top" role="navigation" aria-label="main navigation" v-if="user.authenticated && user.infos.type === authTypes.USER">
<div class="navbar-brand">
<router-link :to="{name: 'home'}" class="navbar-item logo">
@ -150,6 +151,7 @@
</div>
</div>
<notifications position="bottom left" />
</template>
</div>
</template>
@ -157,6 +159,7 @@
import auth from './auth'
import message from './message'
import router from './router'
import {HTTP} from './http-common'
import NamespaceService from './services/namespace'
import authTypes from './models/authTypes'
@ -174,6 +177,21 @@
currentDate: new Date(),
userMenuActive: false,
authTypes: authTypes,
config: null,
}
},
beforeCreate() {
HTTP.get('info')
.then(r => {
this.config = r.data
// eslint-disable-next-line
console.log(this.config)
})
},
computed: {
appReady () {
return !!this.config
}
},
beforeMount() {

View File

@ -188,7 +188,7 @@
copy(text)
},
getShareLink(hash) {
return this.$config.frontend_url + 'share/' + hash + '/auth'
return this.$root.config.frontend_url + 'share/' + hash + '/auth'
},
},
}

View File

@ -20,12 +20,6 @@ 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'