aboutsummaryrefslogtreecommitdiff
path: root/src/components/retweet_button/retweet_button.js
blob: 5a41f22d84814df30ea569849ebcff0aeb8f1bdd (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
32
33
34
35
36

const RetweetButton = {
  props: ['status', 'loggedIn', 'visibility'],
  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,
        'retweeted-empty': !this.status.repeated,
        'animate-spin': this.animated
      }
    },
    mergedConfig () {
      return this.$store.getters.mergedConfig
    }
  }
}

export default RetweetButton