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