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