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