feat: loading spinner on views navigation

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

No files matched your search

+11 -1
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>