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