pleroma-fe/src/components/favorite_button/favorite_button.js
2016-10-30 16:12:35 +01:00

22 lines
470 B
JavaScript

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