0👍
So this code solves the issue:
socket.on('like-new-post', () => {
this.increaseLikeCount(post).then(() => {
socket.off('like-new-post')
})
});
socket.off('like-new-post')
removes the listener and so on the next click there is only one post sent.
- [Vuejs]-I don't have enough knowledge as to why my DOM isn't displaying my API call results from storyblok
- [Vuejs]-Data bound v-if dynamic condition
Source:stackexchange.com