From 857c283fb777ffc9a0a66f8da08980fbb74edb73 Mon Sep 17 00:00:00 2001 From: konrad Date: Mon, 9 Sep 2019 17:32:57 +0000 Subject: [PATCH] Added global api config (#31) --- src/config.js | 16 ++++++++++++++++ src/main.js | 9 +++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/config.js diff --git a/src/config.js b/src/config.js new file mode 100644 index 000000000..d03923f8e --- /dev/null +++ b/src/config.js @@ -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 + }) + } +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index e7b467b1e..53a248e1e 100644 --- a/src/main.js +++ b/src/main.js @@ -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')