aboutsummaryrefslogtreecommitdiff
path: root/src/components/favorite_button/favorite_button.js
blob: 0a8843ea3201336b002f67ceff51c221951ca6cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const FavoriteButton = {
  props: [ 'status' ],
  methods: {
    favorite () {
      if (!this.status.favorited) {
        this.$store.dispatch('favorite', { id: this.status.id})
      } else {
        this.$store.dispatch('unfavorite', { id: this.status.id})
      }
    }
  },
  computed: {
    classes () {
      return {
        'icon-star-empty': !this.status.favorited,
        'icon-star': this.status.favorited
      }
    }
  }
}

export default FavoriteButton