From 512e5b29e1e56d45828d056ee54e2d3626865b11 Mon Sep 17 00:00:00 2001 From: ajatprabha Date: Tue, 23 Oct 2018 18:52:21 +0530 Subject: [PATCH] fix warnings --- ui/src/components/Project.vue | 6 +++--- ui/src/components/ProposalCreateUpdate.vue | 19 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ui/src/components/Project.vue b/ui/src/components/Project.vue index c731d62..b5ff5c8 100644 --- a/ui/src/components/Project.vue +++ b/ui/src/components/Project.vue @@ -27,7 +27,7 @@ @@ -95,8 +95,8 @@ if (mentor) return `${mentor.first_name} ${mentor.last_name}` else return '' }, - getProposalUpdateIdByProjectId (projectId) { - return this.studentProposalList.find(proposal => proposal.project === projectId).id || null + getProposalByProjectId (projectId) { + return this.studentProposalList.find(proposal => proposal.project === projectId) }, remove () { this.$httpClient.delete(`/api/project/projects/${this.project.id}/`).then(response => { diff --git a/ui/src/components/ProposalCreateUpdate.vue b/ui/src/components/ProposalCreateUpdate.vue index 06e0678..a4e602e 100644 --- a/ui/src/components/ProposalCreateUpdate.vue +++ b/ui/src/components/ProposalCreateUpdate.vue @@ -39,7 +39,7 @@ export default { name: 'ProposalCreateUpdate', - props: ['mode', 'updateId', 'projectId'], + props: ['mode', 'baseProposal', 'projectId'], data: () => ({ proposal: { id: '', @@ -100,7 +100,7 @@ }) }, performUpdate () { - this.$httpClient.patch(`/api/project/student-proposal/${this.updateId}/`, { + this.$httpClient.patch(`/api/project/student-proposal/${this.baseProposal.id}/`, { drive_link: this.proposal.drive_link }).then(response => { this.updateProposal(_.cloneDeep(response.data)) @@ -118,17 +118,16 @@ }) }, setProposal () { - if (this.updateId) { - const proposal = this.studentProposalList.find(proposal => proposal.id === this.updateId) - if (proposal) this.proposal = _.cloneDeep(proposal) - else { - this.$httpClient.get(`/api/project/student-proposal/${this.updateId}/`).then(response => { - this.proposal = response.data - }) - } + if (this.baseProposal) { + this.proposal = _.cloneDeep(this.baseProposal) } } }, + watch: { + baseProposal (value) { + if (value !== undefined) this.proposal = _.cloneDeep(value) + } + }, filters: { capitalize: value => value.charAt(0).toUpperCase() + value.slice(1) }