fix infinitescroll to work off correct ID
This commit is contained in:
@@ -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);
|
||||
const oldestId = this.projects[this.projects.length - 1]["rowid"];
|
||||
|
||||
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 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user