diff --git a/src/config.js b/src/config.js new file mode 100644 index 00000000..d03923f8 --- /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 e7b467b1..53a248e1 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')