Make it Kube Ready

This commit is contained in:
Kekskurse 2019-11-27 11:38:41 +01:00
parent 9950de9c50
commit 4003d4063d
3 changed files with 34 additions and 8 deletions

View File

@ -11,7 +11,7 @@
</v-content> </v-content>
</div> </div>
<div v-if="!$store.getters.getAllDataLoaded"> <div v-if="!$store.getters.getAllDataLoaded">
Loading ... {{ status }}
<div v-if="$store.getters.getError"> <div v-if="$store.getters.getError">
Es gab einen Fehler, bitte probiere es später nochmal Es gab einen Fehler, bitte probiere es später nochmal
</div> </div>
@ -22,6 +22,7 @@
<script> <script>
import Menu from "./components/Menu2"; import Menu from "./components/Menu2";
import MenuMobile from "./components/MenuMobile" import MenuMobile from "./components/MenuMobile"
import Server from "./services/Server"
export default { export default {
name: 'App', name: 'App',
@ -32,6 +33,7 @@ export default {
data () { data () {
return { return {
big: true, big: true,
status: 'General Loading....',
bgcolor: "transparent", bgcolor: "transparent",
flat: true, flat: true,
nameBig: '', nameBig: '',
@ -67,12 +69,17 @@ export default {
}*/ }*/
}, },
mounted: function () { mounted: function () {
this.$store.dispatch('checkAccount'); this.status = "Get Backend URL ...";
console.log("MOUNTED"); Server.getAPIUrl().then(() => {
this.$store.dispatch('getSettings').then(() => { this.status = "Loading Basic Data ...";
this.nameBig = this.$store.getters.getSettingValue("name_big"); this.$store.dispatch('checkAccount');
this.nameSmall = this.$store.getters.getSettingValue("name_small"); console.log("MOUNTED");
}); this.$store.dispatch('getSettings').then(() => {
this.nameBig = this.$store.getters.getSettingValue("name_big");
this.nameSmall = this.$store.getters.getSettingValue("name_small");
});
});
} }
} }

View File

@ -3,7 +3,8 @@ import axios from 'axios'
export default() => { export default() => {
return axios.create({ return axios.create({
//baseURL: `http://127.0.0.1:8000/api/`, //baseURL: `http://127.0.0.1:8000/api/`,
baseURL: process.env.VUE_APP_API_URL+`api/`, //baseURL: process.env.VUE_APP_API_URL+`api/`,
baseURL: localStorage.getItem("apiURL"),
withCredentials: false, withCredentials: false,
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',

View File

@ -1,4 +1,5 @@
import Api from '@/services/Api' import Api from '@/services/Api'
import axios from 'axios'
export default { export default {
getPublicSettings (params) { getPublicSettings (params) {
@ -9,5 +10,22 @@ export default {
}, },
getStatus () { getStatus () {
return Api().get("/v1/status/check") return Api().get("/v1/status/check")
},
getAPIUrl () {
return new Promise((resolve, reject) => {
axios.get('/apiurl')
.then(function (response) {
// handle success
localStorage.setItem("apiURL", response+`api/`)
resolve();
})
.catch(function (error) {
if(error.response.status) {
localStorage.setItem("apiURL", process.env.VUE_APP_API_URL+`api/`)
resolve();
}
});
})
} }
} }