2016-10-30 15:12:35 +00:00
|
|
|
const FavoriteButton = {
|
|
|
|
props: [ 'status' ],
|
|
|
|
methods: {
|
|
|
|
favorite () {
|
|
|
|
if (!this.status.favorited) {
|
2016-11-07 14:04:27 +00:00
|
|
|
this.$store.dispatch('favorite', {id: this.status.id})
|
2016-10-30 15:12:35 +00:00
|
|
|
} else {
|
2016-11-07 14:04:27 +00:00
|
|
|
this.$store.dispatch('unfavorite', {id: this.status.id})
|
2016-10-30 15:12:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
classes () {
|
|
|
|
return {
|
|
|
|
'icon-star-empty': !this.status.favorited,
|
|
|
|
'icon-star': this.status.favorited
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default FavoriteButton
|