fixed config

This commit is contained in:
konrad 2018-09-08 21:19:46 +02:00
parent 6a33ad90b5
commit 00362dcf7b
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 27 additions and 85 deletions

46
package-lock.json generated
View File

@ -1205,6 +1205,18 @@
"long": "^3.2.0"
}
},
"@websanova/vue-dot": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@websanova/vue-dot/-/vue-dot-0.1.1.tgz",
"integrity": "sha512-xOroPXFJPs8HpGWHgX4yAk7y7Fce+w7omnGUrzowMI9P5JWTFftE1uBXA5Pm+wdp8nK9E1vgV7gWWrh8llohNA==",
"dev": true
},
"@websanova/vue-env": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/@websanova/vue-env/-/vue-env-0.6.2.tgz",
"integrity": "sha512-ExigiAGJlr7C+U0Y2Y3MmCQ7lJIeMvAjnkzJ1b7X9xBTTUyJQ7M8ReLVZJREZcZx2+NGurpLJE/wJQgBpmn2XQ==",
"dev": true
},
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
@ -4019,6 +4031,12 @@
"is-obj": "^1.0.0"
}
},
"dotenv": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.0.0.tgz",
"integrity": "sha512-FlWbnhgjtwD+uNLUGHbMykMOYQaTivdHEmYwAKFjn6GKe/CqY0fNae93ZHTd20snh9ZLr8mTzIL9m0APQ1pjQg==",
"dev": true
},
"duplexer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
@ -5218,14 +5236,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -5240,20 +5256,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -5370,8 +5383,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -5383,7 +5395,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -5398,7 +5409,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -5406,14 +5416,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@ -5432,7 +5440,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -5513,8 +5520,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -5526,7 +5532,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -5648,7 +5653,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",

View File

@ -1,47 +0,0 @@
/* eslint-disable */
import axios from "axios";
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default {
initConfig() {
//this.config = {VIKUNJA_API_BASE_URL: '/api/v1/'}
axios.get('config.json')
.then(function (response) {
/*console.log('response', response.data);
console.log('self', self.config);
self.config = response.data*/
// eslint-disable-next-line
//console.log(response.data);
localStorage.removeItem('config')
localStorage.setItem('config', JSON.stringify(response.data))
})
.catch(function (error) {
// eslint-disable-next-line
console.log(error);
})
/*console.log('final', conf.data);
return conf.data*/
},
async configReady() {
while(!localStorage.getItem('config')){
await sleep(100);
}
return true
},
get() {
this.configReady()
return JSON.parse(localStorage.getItem('config'))
},
VIKUNJA_API_BASE_URL: '/api/v1/'
}

View File

@ -1,21 +1,6 @@
import axios from 'axios'
//let config = require('../../siteconfig.json')
//import config from '../config/dev.env'
//import Vue from 'vue'
import config from '../config'
config.initConfig()
let conf = config.get()
/*
conf.then(function (r) {
// eslint-disable-next-line
console.log(r)
})*/
config.configReady()
// eslint-disable-next-line
console.log(conf)
let config = require('../../public/config.json')
export const HTTP = axios.create({
baseURL: conf.VIKUNJA_API_BASE_URL
baseURL: config.VIKUNJA_API_BASE_URL
})