akkoma-fe/src/components/retweet_button/retweet_button.js
2018-06-14 17:17:36 -04:00

32 lines
663 B
JavaScript

const RetweetButton = {
props: ['status', 'loggedIn'],
data () {
return {
animated: false
}
},
methods: {
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(() => {
this.animated = false
}, 500)
}
},
computed: {
classes () {
return {
'retweeted': this.status.repeated,
'retweeted-empty': !this.status.repeated,
'animate-spin': this.animated
}
}
}
}
export default RetweetButton