|
@ -118,15 +118,29 @@ 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 }[] = []; |
|
|
|
|
|
current: IIdentifier; |
|
|
|
|
|
isDataLoaded = false; |
|
|
|
|
|
|
|
|
async loadMoreData(payload: boolean) { |
|
|
async loadMoreData(payload: boolean) { |
|
|
console.log("loadMoreData"); |
|
|
console.log("loadMoreData"); |
|
|
console.log(payload); |
|
|
console.log(payload); |
|
|
if (this.projects.length > 0) { |
|
|
if (this.projects.length > 0) { |
|
|
const afterId = this.projects[this.projects.length - 1]["handleId"]; |
|
|
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 url = |
|
|
const url = |
|
|
this.apiServer + "/api/v2/report/plansByIssuer?afterId=" + afterId; |
|
|
this.apiServer + "/api/v2/report/plansByIssuer?afterId=" + afterId; |
|
|
const token = await accessToken(identity); |
|
|
const token = await accessToken(this.current); |
|
|
const headers = { |
|
|
const headers = { |
|
|
"Content-Type": "application/json", |
|
|
"Content-Type": "application/json", |
|
|
Authorization: "Bearer " + token, |
|
|
Authorization: "Bearer " + token, |
|
@ -163,6 +177,7 @@ export default class ProjectsView extends Vue { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async LoadProjects(identity: IIdentifier) { |
|
|
async LoadProjects(identity: IIdentifier) { |
|
|
|
|
|
console.log("LoadProjects"); |
|
|
const url = this.apiServer + "/api/v2/report/plansByIssuer"; |
|
|
const url = this.apiServer + "/api/v2/report/plansByIssuer"; |
|
|
const token = await accessToken(identity); |
|
|
const token = await accessToken(identity); |
|
|
const headers = { |
|
|
const headers = { |
|
@ -185,6 +200,8 @@ export default class ProjectsView extends Vue { |
|
|
}; |
|
|
}; |
|
|
this.projects.push(data); |
|
|
this.projects.push(data); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.isDataLoaded = true; |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error("Got error loading projects: ", error); |
|
|
console.error("Got error loading projects: ", error); |
|
@ -206,6 +223,7 @@ export default class ProjectsView extends Vue { |
|
|
const accounts = await accountsDB.accounts.toArray(); |
|
|
const accounts = await accountsDB.accounts.toArray(); |
|
|
const account = R.find((acc) => acc.did === activeDid, accounts); |
|
|
const account = R.find((acc) => acc.did === activeDid, accounts); |
|
|
const identity = JSON.parse(account?.identity || "undefined"); |
|
|
const identity = JSON.parse(account?.identity || "undefined"); |
|
|
|
|
|
this.current = identity; |
|
|
this.LoadProjects(identity); |
|
|
this.LoadProjects(identity); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|