forked from jsnbuchanan/crowd-funder-for-time-pwa
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 {
|
export default class ProjectsView extends Vue {
|
||||||
apiServer = "";
|
apiServer = "";
|
||||||
projects: { handleId: string; name: string; description: string }[] = [];
|
projects: {
|
||||||
|
handleId: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
rowid: number;
|
||||||
|
}[] = [];
|
||||||
current: IIdentifier;
|
current: IIdentifier;
|
||||||
isDataLoaded = false;
|
isDataLoaded = false;
|
||||||
|
|
||||||
@@ -126,20 +131,10 @@ export default class ProjectsView extends Vue {
|
|||||||
console.log(payload);
|
console.log(payload);
|
||||||
if (this.projects.length > 0) {
|
if (this.projects.length > 0) {
|
||||||
console.log(this.projects[this.projects.length - 1]);
|
console.log(this.projects[this.projects.length - 1]);
|
||||||
const afterurl = this.projects[this.projects.length - 1]["handleId"];
|
const oldestId = this.projects[this.projects.length - 1]["rowid"];
|
||||||
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 url =
|
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 token = await accessToken(this.current);
|
||||||
const headers = {
|
const headers = {
|
||||||
"Content-Type": "application/json",
|
"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
|
// handleId is new in server v release-1.6.0; remove fullIri when that
|
||||||
// version shows up here: https://endorser.ch:3000/api-docs/
|
// version shows up here: https://endorser.ch:3000/api-docs/
|
||||||
handleId: plan.handleId || plan.fullIri,
|
handleId: plan.handleId || plan.fullIri,
|
||||||
|
rowid: plan.rowid,
|
||||||
};
|
};
|
||||||
this.projects.push(data);
|
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
|
// handleId is new in server v release-1.6.0; remove fullIri when that
|
||||||
// version shows up here: https://endorser.ch:3000/api-docs/
|
// version shows up here: https://endorser.ch:3000/api-docs/
|
||||||
handleId: plan.handleId || plan.fullIri,
|
handleId: plan.handleId || plan.fullIri,
|
||||||
|
rowid: plan.rowid,
|
||||||
};
|
};
|
||||||
this.projects.push(data);
|
this.projects.push(data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user