aboutsummaryrefslogtreecommitdiff
path: root/src/components/retweet_button/retweet_button.js
blob: b5b6422cbf21dbbd2e245451593623bc1d9b3b36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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,
        'animate-spin': this.animated
      }
    }
  }
}

export default RetweetButton