clean up code, fix prediction bug
This commit is contained in:
parent
b32888194c
commit
b10b92a876
7 changed files with 122 additions and 89 deletions
30
src/components/emoji_reactions/emoji_reactions.js
Normal file
30
src/components/emoji_reactions/emoji_reactions.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
|
||||
const EmojiReactions = {
|
||||
name: 'EmojiReactions',
|
||||
props: ['status'],
|
||||
computed: {
|
||||
emojiReactions () {
|
||||
return this.status.emojiReactions
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reactedWith (emoji) {
|
||||
return this.status.reactedWithEmoji.includes(emoji)
|
||||
},
|
||||
reactWith (emoji) {
|
||||
this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
|
||||
},
|
||||
unreact (emoji) {
|
||||
this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji })
|
||||
},
|
||||
emojiOnClick (emoji, event) {
|
||||
if (this.reactedWith(emoji)) {
|
||||
this.unreact(emoji)
|
||||
} else {
|
||||
this.reactWith(emoji)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default EmojiReactions
|
Loading…
Add table
Add a link
Reference in a new issue