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

View file

@ -1,4 +1,5 @@
import Api from '@/services/Api'
import axios from 'axios'
export default {
getPublicSettings (params) {
@ -9,5 +10,22 @@ export default {
},
getStatus () {
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();
}
});
})
}
}