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

36 lines
753 B
JavaScript
Raw Normal View History

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