pleroma-fe/src/components/retweet_button/retweet_button.js

33 lines
677 B
JavaScript
Raw Normal View History

const RetweetButton = {
2018-08-10 02:46:18 +10:00
props: ['status', 'loggedIn', 'visibility'],
data () {
return {
animated: false
}
},
methods: {
retweet () {
2016-11-14 03:09:16 +11:00
if (!this.status.repeated) {
this.$store.dispatch('retweet', {id: this.status.id})
2018-06-14 19:00:11 +10:00
} else {
this.$store.dispatch('unretweet', {id: this.status.id})
2016-11-14 03:09:16 +11:00
}
this.animated = true
setTimeout(() => {
this.animated = false
}, 500)
}
},
computed: {
classes () {
return {
'retweeted': this.status.repeated,
2018-06-15 07:17:36 +10:00
'retweeted-empty': !this.status.repeated,
'animate-spin': this.animated
}
}
}
}
export default RetweetButton