From 08b551201fe72e71fd031a22542439d3e1b70169 Mon Sep 17 00:00:00 2001 From: Fulgen301 Date: Sun, 16 Sep 2018 16:59:45 +0200 Subject: Initial adapt to LegacyClonk --- src/components/UploadVoter.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/components/UploadVoter.vue') diff --git a/src/components/UploadVoter.vue b/src/components/UploadVoter.vue index e5d18ae..b929a45 100644 --- a/src/components/UploadVoter.vue +++ b/src/components/UploadVoter.vue @@ -45,16 +45,17 @@ }, computed: { myVote () { - if (!this.upload || !this.upload.voting || !Array.isArray(this.upload.voting.votes) || this.upload.voting.votes.length === 0) { - return undefined + if (!this.upload.voting.vote) { + let that = this + this.$http.get(`/uploads/${this.upload.id}/vote`).then((response) => { this.upload.voting.vote = response.data }) } - return this.upload.voting.votes[0] + return this.upload.voting.vote }, }, methods: { vote (impact) { let that = this - this.$http.post(`/uploads/${this.upload._id}/vote`, {impact: impact}).then(response => that.$emit('voted')) + this.$http.post(`/uploads/${this.upload.id}/vote`, {impact: impact}).then(response => that.$emit('voted')) }, }, } -- cgit v1.2.3-54-g00ecf