From d05fcfa1a84d8f8089e1d691e8bd3e0d0960139c Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Thu, 14 Jun 2018 05:00:11 -0400 Subject: Add unretweet support --- src/components/retweet_button/retweet_button.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/components/retweet_button/retweet_button.js') diff --git a/src/components/retweet_button/retweet_button.js b/src/components/retweet_button/retweet_button.js index 4a43542d..b5b6422c 100644 --- a/src/components/retweet_button/retweet_button.js +++ b/src/components/retweet_button/retweet_button.js @@ -9,6 +9,8 @@ const RetweetButton = { retweet () { if (!this.status.repeated) { this.$store.dispatch('retweet', {id: this.status.id}) + } else { + this.$store.dispatch('unretweet', {id: this.status.id}) } this.animated = true setTimeout(() => { -- cgit v1.2.3-70-g09d2 From 556eb4b8a33346ecfee57ed2b3e0f65584ff8359 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Thu, 14 Jun 2018 17:17:36 -0400 Subject: add unretweet action to statuses.js --- src/components/retweet_button/retweet_button.js | 1 + src/modules/statuses.js | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'src/components/retweet_button/retweet_button.js') diff --git a/src/components/retweet_button/retweet_button.js b/src/components/retweet_button/retweet_button.js index b5b6422c..9833e8b2 100644 --- a/src/components/retweet_button/retweet_button.js +++ b/src/components/retweet_button/retweet_button.js @@ -22,6 +22,7 @@ const RetweetButton = { classes () { return { 'retweeted': this.status.repeated, + 'retweeted-empty': !this.status.repeated, 'animate-spin': this.animated } } diff --git a/src/modules/statuses.js b/src/modules/statuses.js index b493c212..291ab53c 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -388,6 +388,10 @@ const statuses = { commit('setRetweeted', { status, value: true }) apiService.retweet({ id: status.id, credentials: rootState.users.currentUser.credentials }) }, + unretweet ({ rootState, commit }, status) { + commit('setRetweeted', { status, value: false }) + apiService.unretweet({ id: status.id, credentials: rootState.users.currentUser.credentials }) + }, queueFlush ({ rootState, commit }, { timeline, id }) { commit('queueFlush', { timeline, id }) } -- cgit v1.2.3-70-g09d2