aboutsummaryrefslogtreecommitdiff
path: root/src/components/favorite_button/favorite_button.js
blob: 4ee3890fb325f95c541e3ad27e71e7b957e052f0 (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