follow and unfollow node js button

Solutions on MaxInterview for follow and unfollow node js button by the best coders in the world

showing results for - "follow and unfollow node js button"
Giovanni
14 Oct 2017
1<% if(isLoggedIn) { %>
2                       <% if(user && user._id != currentUser._id) { %>
3                       <% const following = user.following;
4                          const action = following.includes(currentUser._id) ? 'unfollow' : 'follow';
5                       %>
6                        <button class="btn btn-primary ml-4" data-action="<%= action %>" data-follower="<%= user._id %>" data-following="<%= currentUser._id %>" id="follow-btn">Follow</button>
7                       <% } %>  
8                    <% } %> 
9