Added loading state to ViewObservations

This commit is contained in:
neviyn 2019-02-15 16:13:13 +00:00
parent e6f2963e88
commit 15024b3a84

View File

@ -126,6 +126,9 @@
</b-card>
<b-button class="mt-2" variant="success" @click="getCSV()">CSV Dump</b-button>
</b-container>
<b-container v-else-if="loading">
Loading...
</b-container>
<b-container v-else>
<b-row>
<b-col>
@ -152,7 +155,8 @@ export default {
return {
observationData: null,
errorStatus: null,
errorMessage: null
errorMessage: null,
loading: false
};
},
computed: {
@ -175,6 +179,7 @@ export default {
},
methods: {
getFiltered: function() {
this.loading = true
Vue.axios
.post("/observations", {
site: this.$store.state.search.site,
@ -186,11 +191,13 @@ export default {
})
.then(response => {
this.observationData = response.data;
this.loading = false
})
.catch(error => {
this.errorStatus = error.response.status;
this.errorMessage = error.response.data;
this.$refs.errorModal.show();
this.loading = false
});
},
getCSV: function() {