summaryrefslogtreecommitdiff
path: root/pages/admin/models.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/models.vue
parente7051ff7dc705cee2360798df86613632b305ba2 (diff)
Add pagination on admin cp
Diffstat (limited to 'pages/admin/models.vue')
-rw-r--r--pages/admin/models.vue21
1 files changed, 18 insertions, 3 deletions
diff --git a/pages/admin/models.vue b/pages/admin/models.vue
index 86b463b..66f20cf 100644
--- a/pages/admin/models.vue
+++ b/pages/admin/models.vue
@@ -10,12 +10,14 @@
:fields="models"
path="/models/"
)
+ pagination(:page="page" :pages="pages" v-if="count" path="/admin/models")
</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: "Models ยท Verden" },
computed: {
...mapGetters("auth", ["isLogged", "me"]),
- ...mapGetters("models", ["models"]),
+ ...mapGetters("models", ["models", "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("models/getModels", 0);
+ this.page = this.$route.query.page ?? 0;
+ this.$store.dispatch("models/getModels", this.page).then(() => {
+ this.pages = Math.ceil(this.count / 20);
+ });
},
};
</script>