@@ -331,7 +380,7 @@
- Contributions From This Idea
+ Projects Getting Contributions From This
@@ -401,6 +450,8 @@ export default class ProjectViewView extends Vue {
fulfillersToHitLimit = false;
givesToThis: Array = [];
givesHitLimit = false;
+ givesProvidedByThis: Array = [];
+ givesProvidedByHitLimit = false;
imageUrl = "";
issuer = "";
latitude = 0;
@@ -540,9 +591,11 @@ export default class ProjectViewView extends Vue {
this.loadGives();
+ this.loadGivesProvidedBy();
+
this.loadOffers();
- this.loadFulfillersTo();
+ this.loadPlanFulfillersTo();
// now load fulfilled-by, a single project
if (identity) {
@@ -696,7 +749,7 @@ export default class ProjectViewView extends Vue {
}
}
- async loadFulfillersTo() {
+ async loadPlanFulfillersTo() {
const fulfillsUrl =
this.apiServer +
"/api/v2/report/planFulfillersToPlan?planHandleId=" +
@@ -752,6 +805,64 @@ export default class ProjectViewView extends Vue {
}
}
+ async loadGivesProvidedBy() {
+ const providedByUrl =
+ this.apiServer +
+ "/api/v2/report/givesProvidedBy?providerId=" +
+ encodeURIComponent(this.projectId);
+ let postfix = "";
+ if (this.givesProvidedByThis.length > 0) {
+ postfix =
+ "&beforeId=" +
+ this.givesProvidedByThis[this.givesProvidedByThis.length - 1].jwtId;
+ }
+ const providedByFullUrl = providedByUrl + postfix;
+
+ const headers: RawAxiosRequestHeaders = {
+ "Content-Type": "application/json",
+ };
+ const identity = await this.getIdentity(this.activeDid);
+ if (identity) {
+ const token = await accessToken(identity);
+ headers["Authorization"] = "Bearer " + token;
+ }
+
+ try {
+ const resp = await this.axios.get(providedByFullUrl, { headers });
+ if (resp.status === 200) {
+ this.givesProvidedByThis = this.givesProvidedByThis.concat(
+ resp.data.data,
+ );
+ this.givesProvidedByHitLimit = resp.data.hitLimit;
+ } else {
+ this.$notify(
+ {
+ group: "alert",
+ type: "danger",
+ title: "Error",
+ text: "Failed to retrieve gives that were provided by this project.",
+ },
+ 5000,
+ );
+ }
+ } catch (error: unknown) {
+ const serverError = error as AxiosError;
+ this.$notify(
+ {
+ group: "alert",
+ type: "danger",
+ title: "Error",
+ text: "Something went wrong retrieving gives that were provided by this project.",
+ },
+ 5000,
+ );
+ console.error(
+ "Something went wrong retrieving gives that were provided by this project:",
+ serverError.message,
+ );
+ }
+ }
+
/**
* Handle clicking on a project entry found in the list
* @param id of the project