Added error message to Stats page.

This commit is contained in:
neviyn 2018-09-21 10:27:00 +01:00
parent 78ef256d8d
commit a368677573

View File

@ -1,5 +1,18 @@
<template>
<b-container>
<b-modal ref="errorModal" class="text-center" centered hide-header hide-footer>
<div class="modal-header">
<h3 class="modal-title w-100">{{ errorStatus }}</h3>
</div>
<div class="d-block">
<br />
<span style="font-size:20px;" v-html="errorMessage" />
<button class="btn btn-warning" @click="$refs.errorModal.hide()">
<v-icon name="exclamation-circle" /> Dismiss</button>
</div>
</b-modal>
<stats-view v-if="chartData != null && chartData != {}" :data="chartData" :options="options" />
</b-container>
</template>
<script>
@ -11,13 +24,22 @@ export default {
data: function() {
return {
chartData: null,
options: null
options: null,
errorStatus: null,
errorMessage: null
};
},
methods: {
getAllTimeAverage: function() {
Vue.axios.get("/api/average/all/chartjs").then(response => {
Vue.axios
.get("/api/average/all/chartjs")
.then(response => {
this.chartData = response.data;
})
.catch(error => {
this.errorStatus = error.response.status;
this.errorMessage = error.response.data;
this.$refs.errorModal.show();
});
}
},