From 42bf34f54949c20598f94003517117d5ca4665cd Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sat, 24 Jun 2023 06:45:03 -0600 Subject: [PATCH] fix infinitescroll to work off correct ID --- src/views/ProjectsView.vue | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/views/ProjectsView.vue b/src/views/ProjectsView.vue index 6db6ece6..50f00d2f 100644 --- a/src/views/ProjectsView.vue +++ b/src/views/ProjectsView.vue @@ -117,7 +117,12 @@ import InfiniteScroll from "@/components/InfiniteScroll"; }) export default class ProjectsView extends Vue { apiServer = ""; - projects: { handleId: string; name: string; description: string }[] = []; + projects: { + handleId: string; + name: string; + description: string; + rowid: number; + }[] = []; current: IIdentifier; isDataLoaded = false; @@ -126,20 +131,10 @@ export default class ProjectsView extends Vue { console.log(payload); if (this.projects.length > 0) { console.log(this.projects[this.projects.length - 1]); - const afterurl = this.projects[this.projects.length - 1]["handleId"]; - const regex = /([0-9A-Z]+)$/; // Regular expression to match one or more digits at the end - const matches = afterurl.match(regex); - - let afterId = ""; - if (matches && matches.length > 1) { - afterId = matches[1]; - console.log(afterId); // Output: 01H3HBVZGH3YE0K27X35S15QT1 - } else { - console.log("No digits found at the end of the URL."); - return; - } + const oldestId = this.projects[this.projects.length - 1]["rowid"]; + const url = - this.apiServer + "/api/v2/report/plansByIssuer?afterId=" + afterId; + this.apiServer + "/api/v2/report/plansByIssuer?beforeId=" + oldestId; const token = await accessToken(this.current); const headers = { "Content-Type": "application/json", @@ -158,6 +153,7 @@ export default class ProjectsView extends Vue { // handleId is new in server v release-1.6.0; remove fullIri when that // version shows up here: https://endorser.ch:3000/api-docs/ handleId: plan.handleId || plan.fullIri, + rowid: plan.rowid, }; this.projects.push(data); } @@ -197,6 +193,7 @@ export default class ProjectsView extends Vue { // handleId is new in server v release-1.6.0; remove fullIri when that // version shows up here: https://endorser.ch:3000/api-docs/ handleId: plan.handleId || plan.fullIri, + rowid: plan.rowid, }; this.projects.push(data); }