From 2325d12395e0a7e7f944165e7de4d9e88915b4d6 Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Thu, 13 Oct 2022 22:35:20 +0200
Subject: Add pagination on admin cp

---
 components/Pagination.vue | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'components/Pagination.vue')

diff --git a/components/Pagination.vue b/components/Pagination.vue
index e751dd8..7925ab0 100644
--- a/components/Pagination.vue
+++ b/components/Pagination.vue
@@ -4,7 +4,7 @@
       ul.flex.list-style-none.items-center.justify-center
         li.page-item(:class="{'cursor-not-allowed opacity-20 page-item disabled': page < 1}")
           a.page-link.relative.block.py-1.px-3.rounded.border-0.bg-transparent.outline-none.transition-all.duration-300.rounded.text-gray-800(
-            :href="(page == 0) ? '#' : '/?page='+incrPage(-1)"
+            :href="(page == 0) ? '#' : (path ?? '/')+'?page='+incrPage(-1)"
             class="hover:text-gray-800 hover:bg-gray-200 focus:shadow-none dark:text-white"
           )
             span.sr-only Previous
@@ -12,12 +12,12 @@
               path(fill-rule="evenodd", d="M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z", clip-rule="evenodd")
         li.page-item(v-for="i in pages")
           a.page-link.relative.block.py-1.px-3.rounded.border-0.bg-transparent.outline-none.transition-all.duration-300.rounded.text-gray-800(
-            :href="'/?page='+(i-1)" aria-current="page"
+            :href="(path ?? '/')+'?page='+(i-1)" aria-current="page"
             :class="{'hover:text-gray-800 hover:bg-gray-200 focus:shadow-none dark:text-white': true, 'bg-green-500 text-green-50 hover:text-green-50': page == (i-1)}"
           ) {{ i-1 }}
         li.page-item(:class="{'cursor-not-allowed opacity-20 page-item disabled': page == pages-1}")
           a.page-link.relative.block.py-1.px-3.rounded.border-0.bg-transparent.outline-none.transition-all.duration-300.rounded.text-gray-800(
-            :href="(page == (pages-1)) ? '#' : '/?page='+incrPage(1)"
+            :href="(page == (pages-1)) ? '#' : (path ?? '/')+'?page='+incrPage(1)"
             class="hover:text-gray-800 hover:bg-gray-200 focus:shadow-none dark:text-white"
           )
             span.sr-only Next
@@ -28,7 +28,7 @@
 <script>
 export default {
   name: "Pagination",
-  props: ["page", "pages"],
+  props: ["page", "pages", "path"],
   methods: {
     incrPage(value) {
       return Number(this.page) + value;
-- 
cgit v1.2.3-18-g5258

