feat: loading spinner on views navigation

This commit is contained in:
Ramires Viana
2021-04-16 12:47:50 +00:00
parent b92152693f
commit 976eb5583d
13 changed files with 185 additions and 77 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="row">
<div class="row" v-if="!loading">
<div class="column">
<div class="card">
<div class="card-title">
@@ -41,6 +41,7 @@
</template>
<script>
import { mapState, mapMutations } from "vuex";
import { users as api } from "@/api";
export default {
@@ -51,11 +52,20 @@ export default {
};
},
async created() {
this.setLoading(true);
try {
this.users = await api.getAll();
this.setLoading(false);
} catch (e) {
this.$showError(e);
}
},
computed: {
...mapState(["loading"]),
},
methods: {
...mapMutations(["setLoading"]),
},
};
</script>