Browse Source

fix problem switching projects where old link data remained

split_build_process
Trent Larson 2 weeks ago
parent
commit
1e66bc1126
  1. 94
      src/views/ProjectViewView.vue

94
src/views/ProjectViewView.vue

@ -657,29 +657,47 @@ export default class ProjectViewView extends Vue {
);
}
this.givesToThis = [];
this.loadGives();
this.givesProvidedByThis = [];
this.loadGivesProvidedBy();
this.offersToThis = [];
this.loadOffers();
this.fulfillersToThis = [];
this.loadPlanFulfillersTo();
const fulfilledByUrl =
this.fulfilledByThis = null;
this.loadPlanFulfilledBy();
}
async loadGives() {
const givesUrl =
this.apiServer +
"/api/v2/report/planFulfilledByPlan?planHandleId=" +
encodeURIComponent(projectId);
"/api/v2/report/givesToPlans?planIds=" +
encodeURIComponent(JSON.stringify([this.projectId]));
let postfix = "";
if (this.givesToThis.length > 0) {
postfix =
"&beforeId=" + this.givesToThis[this.givesToThis.length - 1].jwtId;
}
const givesInUrl = givesUrl + postfix;
const headers = await serverUtil.getHeaders(this.activeDid);
try {
const resp = await this.axios.get(fulfilledByUrl, { headers });
if (resp.status === 200) {
this.fulfilledByThis = resp.data.data;
const resp = await this.axios.get(givesInUrl, { headers });
if (resp.status === 200 && resp.data.data) {
this.givesToThis = this.givesToThis.concat(resp.data.data);
this.givesHitLimit = resp.data.hitLimit;
} else {
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Failed to retrieve plans fulfilled by this project.",
text: "Failed to retrieve more gives to this project.",
},
5000,
);
@ -691,42 +709,45 @@ export default class ProjectViewView extends Vue {
group: "alert",
type: "danger",
title: "Error",
text: "Something went wrong retrieving plans fulfilled by this project.",
text: "Something went wrong retrieving more gives to this project.",
},
5000,
);
console.error(
"Error retrieving plans fulfilled by this project:",
"Something went wrong retrieving more gives to this project:",
serverError.message,
);
}
}
async loadGives() {
const givesUrl =
async loadGivesProvidedBy() {
const providedByUrl =
this.apiServer +
"/api/v2/report/givesToPlans?planIds=" +
encodeURIComponent(JSON.stringify([this.projectId]));
"/api/v2/report/givesProvidedBy?providerId=" +
encodeURIComponent(this.projectId);
let postfix = "";
if (this.givesToThis.length > 0) {
if (this.givesProvidedByThis.length > 0) {
postfix =
"&beforeId=" + this.givesToThis[this.givesToThis.length - 1].jwtId;
"&beforeId=" +
this.givesProvidedByThis[this.givesProvidedByThis.length - 1].jwtId;
}
const givesInUrl = givesUrl + postfix;
const providedByFullUrl = providedByUrl + postfix;
const headers = await serverUtil.getHeaders(this.activeDid);
try {
const resp = await this.axios.get(givesInUrl, { headers });
if (resp.status === 200 && resp.data.data) {
this.givesToThis = this.givesToThis.concat(resp.data.data);
this.givesHitLimit = resp.data.hitLimit;
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 more gives to this project.",
text: "Failed to retrieve gives that were provided by this project.",
},
5000,
);
@ -738,12 +759,12 @@ export default class ProjectViewView extends Vue {
group: "alert",
type: "danger",
title: "Error",
text: "Something went wrong retrieving more gives to this project.",
text: "Something went wrong retrieving gives that were provided by this project.",
},
5000,
);
console.error(
"Something went wrong retrieving more gives to this project:",
"Something went wrong retrieving gives that were provided by this project:",
serverError.message,
);
}
@ -844,34 +865,23 @@ export default class ProjectViewView extends Vue {
}
}
async loadGivesProvidedBy() {
const providedByUrl =
async loadPlanFulfilledBy() {
const fulfilledByUrl =
this.apiServer +
"/api/v2/report/givesProvidedBy?providerId=" +
"/api/v2/report/planFulfilledByPlan?planHandleId=" +
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 = await serverUtil.getHeaders(this.activeDid);
try {
const resp = await this.axios.get(providedByFullUrl, { headers });
const resp = await this.axios.get(fulfilledByUrl, { headers });
if (resp.status === 200) {
this.givesProvidedByThis = this.givesProvidedByThis.concat(
resp.data.data,
);
this.givesProvidedByHitLimit = resp.data.hitLimit;
this.fulfilledByThis = resp.data.data;
} else {
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Failed to retrieve gives that were provided by this project.",
text: "Failed to retrieve plans fulfilled by this project.",
},
5000,
);
@ -883,12 +893,12 @@ export default class ProjectViewView extends Vue {
group: "alert",
type: "danger",
title: "Error",
text: "Something went wrong retrieving gives that were provided by this project.",
text: "Something went wrong retrieving plans fulfilled by this project.",
},
5000,
);
console.error(
"Something went wrong retrieving gives that were provided by this project:",
"Error retrieving plans fulfilled by this project:",
serverError.message,
);
}

Loading…
Cancel
Save