[Vuejs]-Vue payload data multiplies on click

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.

Leave a comment