forked from jsnbuchanan/crowd-funder-for-time-pwa
feat: adjust to the new endpoints for editable plan records
This commit is contained in:
@@ -157,10 +157,7 @@ export default class ProjectViewView extends Vue {
|
||||
truncatedDesc = "";
|
||||
truncateLength = 40;
|
||||
timeSince = "";
|
||||
projectId =
|
||||
localStorage.getItem("projectId") === null
|
||||
? ""
|
||||
: localStorage.getItem("projectId");
|
||||
projectId = localStorage.getItem("projectId") || "";
|
||||
|
||||
onEditClick() {
|
||||
localStorage.setItem("projectId", this.projectId as string);
|
||||
@@ -181,7 +178,8 @@ export default class ProjectViewView extends Vue {
|
||||
|
||||
async LoadProject(identity: IIdentifier) {
|
||||
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER;
|
||||
const url = endorserApiServer + "/api/claim/" + this.projectId;
|
||||
const url =
|
||||
endorserApiServer + "/api/plan/" + encodeURIComponent(this.projectId);
|
||||
const token = await accessToken(identity);
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
@@ -192,13 +190,12 @@ export default class ProjectViewView extends Vue {
|
||||
const resp = await this.axios.get(url, { headers });
|
||||
console.log(resp.status, resp.data);
|
||||
if (resp.status === 200) {
|
||||
const claim = resp.data.claim;
|
||||
const issuedAt = resp.data.issuedAt;
|
||||
const eventDate = new Date(issuedAt);
|
||||
const startTime = resp.data.startTime;
|
||||
const eventDate = new Date(startTime);
|
||||
const now = moment.now();
|
||||
this.timeSince = moment.utc(now).to(eventDate);
|
||||
this.name = claim.name;
|
||||
this.description = claim.description;
|
||||
this.name = resp.data.name;
|
||||
this.description = resp.data.description;
|
||||
this.truncatedDesc = this.description.slice(0, this.truncateLength);
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user