summaryrefslogtreecommitdiff
path: root/pages/admin/index.vue
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-10-13 22:35:20 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-10-13 22:35:20 +0200
commit2325d12395e0a7e7f944165e7de4d9e88915b4d6 (patch)
tree991ae85bb8dc9251f83a7055dab2ad183a512af0 /pages/admin/index.vue
parente7051ff7dc705cee2360798df86613632b305ba2 (diff)
Add pagination on admin cp
Diffstat (limited to 'pages/admin/index.vue')
-rw-r--r--pages/admin/index.vue21
1 files changed, 18 insertions, 3 deletions
diff --git a/pages/admin/index.vue b/pages/admin/index.vue
index 679f82f..e08f819 100644
--- a/pages/admin/index.vue
+++ b/pages/admin/index.vue
@@ -10,12 +10,14 @@
:fields="users"
path="/users/"
)
+ pagination(:page="page" :pages="pages" v-if="count" path="/admin")
</template>
<script>
import { mapGetters } from "vuex";
import AdminSidebar from "@/components/AdminSidebar.vue";
+import Pagination from "@/components/Pagination.vue";
import VTable from "@/components/VTable.vue";
export default {
@@ -23,9 +25,19 @@ export default {
head: { title: "Admin panel ยท Verden" },
computed: {
...mapGetters("auth", ["isLogged", "me"]),
- ...mapGetters("users", ["users"]),
+ ...mapGetters("users", ["users", "count"]),
+ },
+ data() {
+ return {
+ page: 0,
+ pages: 0,
+ };
+ },
+ components: {
+ AdminSidebar,
+ pagination: Pagination,
+ "v-table": VTable,
},
- components: { AdminSidebar, "v-table": VTable },
async mounted() {
await this.$store.dispatch("auth/findMe");
@@ -33,7 +45,10 @@ export default {
window.location.href = "/";
}
- this.$store.dispatch("users/getUsers", { page: 0 });
+ this.page = this.$route.query.page ?? 0;
+ this.$store.dispatch("users/getUsers", this.page).then(() => {
+ this.pages = Math.ceil(this.count / 20);
+ });
},
};
</script>