const commentsList = document.getElementById('comment');
commentsList.innerHTML = '';
post.comments.forEach(comment => {
// 각 댓글 항목을 생성함
const commentItem = document.createElement('li');
commentItem.innerHTML = `
<a href="/api/accounts/profile/${comment.user_pk}">
<img src="${comment.user_profile_image}" alt="${comment.user_nickname}의 프로필 사진" style=" height: 30px; border-radius: 10%;">
</a>
<p>${comment.content}</p>
<p>작성자: ${comment.user_nickname} | 작성일: ${formatDate(comment.created_at)}</p>
<button onclick="editComment(${comment.id})">수정</button>
<button onclick="deleteComment(${comment.id})">삭제</button>
이대로 넣으니
http://127.0.0.1:8000/api/accounts/profile/undefined
이렇게 undefined가 나옴 해결 방법! 그냥 user.pk를 넣는다!
댓글이 없어짐!
그냥 해결 방법은
comment.user 쓰면됨!