From f352cfc8e65bcccd5bb5cdf3daca1d2ea71fde63 Mon Sep 17 00:00:00 2001 From: Badhusha Date: Tue, 8 Oct 2024 10:24:14 +0530 Subject: [PATCH] pagination --- web/src/API/index.js | 9 +- web/src/components/Pagination.vue | 125 ++++ web/src/views/table.vue | 910 +++++++++++++++++++++++------- 3 files changed, 835 insertions(+), 209 deletions(-) create mode 100644 web/src/components/Pagination.vue diff --git a/web/src/API/index.js b/web/src/API/index.js index d00a3c4..64acf21 100644 --- a/web/src/API/index.js +++ b/web/src/API/index.js @@ -154,7 +154,7 @@ export const deletesuggestions = async (suggestionId) => { // get items - export const getitem = async () => { + export const getitem = async (page) => { try { // Retrieve cookies and find the token const cookies = document.cookie.split(';'); @@ -173,12 +173,15 @@ export const deletesuggestions = async (suggestionId) => { } // Make the API call with the token in headers - const res = await axios.get(`${import.meta.env.VITE_APP_API_BASE_URL}/api/v1/items?limit=100`, { + const res = await axios.get(`${import.meta.env.VITE_APP_API_BASE_URL}/api/v1/items`, { headers: { Authorization: `Bearer ${token}`, }, + params: { + page: page + }, - }); + }); return res; } catch (error) { diff --git a/web/src/components/Pagination.vue b/web/src/components/Pagination.vue new file mode 100644 index 0000000..8a26758 --- /dev/null +++ b/web/src/components/Pagination.vue @@ -0,0 +1,125 @@ + + + \ No newline at end of file diff --git a/web/src/views/table.vue b/web/src/views/table.vue index 7ba3e79..29e32b2 100644 --- a/web/src/views/table.vue +++ b/web/src/views/table.vue @@ -1,27 +1,57 @@
-
- - +
+ +
- + - - + + @@ -51,34 +99,51 @@ - + +
Scientific Name Images Category Created by Updated by
{{ entry.scientificName }}
+ + + + + + +
+ {{ vernacularName.place }}: + {{ vernacularName.name }}
+
- +
{{ entry.description.slice(0, 50) }}... - Link + Link {{ entry.category }} @@ -91,14 +156,40 @@
-
@@ -108,124 +199,446 @@
-
-
-

{{ editIndex === null ? 'Add New Entry' : 'Edit Entry' }}

-
+
+
+

+ {{ editIndex === null ? "Add New Entry" : "Edit Entry" }} +

+ +
+
+
+ + +
+
+ + +
+
-
-
-
- - -
-
- - -
-
- -
- - -
- -
- - -
-
-
- - +
+ +
+
+
+
+ + + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
- -
-
- - -
-
- - -
+
+ + +
+
- -
-
- - +
+ + +
+
+ + +
+ -
- - -
- -
-
-
\ No newline at end of file + -- knotmirror 0.0.1