비밀번호 입력창 초기화
This commit is contained in:
parent
3678b40e1c
commit
785df5c51f
@ -43,7 +43,7 @@
|
||||
</div>
|
||||
|
||||
<PlusButton v-if="isPlusButton" @click="toggleComment" class="mt-6"/>
|
||||
<BoardCommentArea v-if="isComment" :unknown="unknown" :commentAlert="commentAlert" :passwordAlert="passwordAlert" @submitComment="submitComment"/>
|
||||
<BoardCommentArea v-if="isComment" :unknown="unknown" @submitComment="submitComment"/>
|
||||
|
||||
<!-- 대댓글 -->
|
||||
<ul v-if="comment.children && comment.children.length" class="list-unstyled">
|
||||
@ -63,8 +63,6 @@
|
||||
:currentPasswordCommentId="currentPasswordCommentId"
|
||||
:passwordCommentAlert="passwordCommentAlert"
|
||||
:password="password"
|
||||
:commentAlert="commentAlert"
|
||||
:passwordAlert="passwordAlert"
|
||||
@editClick="handleReplyEditClick"
|
||||
@deleteClick="$emit('deleteClick', child)"
|
||||
@submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent)"
|
||||
@ -125,12 +123,6 @@ const props = defineProps({
|
||||
password:{
|
||||
type: String
|
||||
},
|
||||
commentAlert: {
|
||||
type: String,
|
||||
},
|
||||
passwordAlert: {
|
||||
type: String,
|
||||
}
|
||||
});
|
||||
|
||||
// emits 정의
|
||||
|
||||
@ -14,8 +14,6 @@
|
||||
:passwordCommentAlert="passwordCommentAlert || ''"
|
||||
:currentPasswordCommentId="currentPasswordCommentId"
|
||||
:password="password"
|
||||
:commentAlert="commentAlert"
|
||||
:passwordAlert="passwordAlert"
|
||||
@editClick="handleEditClick"
|
||||
@deleteClick="handleDeleteClick"
|
||||
@submitPassword="submitPassword"
|
||||
@ -65,12 +63,6 @@ const props = defineProps({
|
||||
password:{
|
||||
type: String
|
||||
},
|
||||
commentAlert: {
|
||||
type: String,
|
||||
},
|
||||
passwordAlert: {
|
||||
type: String,
|
||||
}
|
||||
});
|
||||
|
||||
const emit = defineEmits(['submitComment', 'updateReaction', 'editClick', 'deleteClick', 'submitPassword', 'clearPassword','submitEdit', 'update:password']);
|
||||
|
||||
@ -105,8 +105,6 @@
|
||||
:passwordCommentAlert="passwordCommentAlert"
|
||||
:currentPasswordCommentId="currentPasswordCommentId"
|
||||
:password="password"
|
||||
:commentAlert="commentAlert"
|
||||
:passwordAlert="passwordAlert"
|
||||
@editClick="editComment"
|
||||
@deleteClick="deleteComment"
|
||||
@updateReaction="handleCommentReaction"
|
||||
@ -412,7 +410,7 @@ const handleCommentReply = async (reply) => {
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
if (response.data.code === 200) {
|
||||
if (response.data.code === 200) {
|
||||
await fetchComments();
|
||||
} else {
|
||||
alert('대댓글 작성을 실패했습니다.');
|
||||
@ -459,8 +457,12 @@ const findCommentById = (commentId, commentsList) => {
|
||||
return null;
|
||||
};
|
||||
|
||||
// 댓글 수정 버튼 클릭
|
||||
// 댓글 수정(대댓글 포함)
|
||||
const editComment = (comment) => {
|
||||
password.value = '';
|
||||
passwordCommentAlert.value = '';
|
||||
currentPasswordCommentId.value = null;
|
||||
|
||||
const targetComment = findCommentById(comment.commentId, comments.value);
|
||||
|
||||
if (!targetComment) {
|
||||
@ -496,12 +498,16 @@ const deleteComment = async (comment) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 익명 비밀번호 창 토글
|
||||
// 익명 댓글 비밀번호 창 토글
|
||||
const toggleCommentPassword = (comment, button) => {
|
||||
if (lastCommentClickedButton.value === button && currentPasswordCommentId.value === comment.commentId) {
|
||||
currentPasswordCommentId.value = null; // 비밀번호 창 닫기
|
||||
password.value = '';
|
||||
passwordCommentAlert.value = '';
|
||||
} else {
|
||||
currentPasswordCommentId.value = comment.commentId; // 비밀번호 창 열기
|
||||
password.value = '';
|
||||
passwordCommentAlert.value = '';
|
||||
}
|
||||
|
||||
lastCommentClickedButton.value = button;
|
||||
@ -557,7 +563,7 @@ const submitPassword = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 댓글 삭제 (비밀번호 확인 후)
|
||||
// 댓글 (비밀번호 확인 후)
|
||||
const submitCommentPassword = async (comment, password) => {
|
||||
if (!password) {
|
||||
passwordCommentAlert.value = "비밀번호를 입력해주세요.";
|
||||
@ -573,20 +579,25 @@ const submitCommentPassword = async (comment, password) => {
|
||||
});
|
||||
|
||||
if (response.data.code === 200 && response.data.data === true) {
|
||||
passwordCommentAlert.value = "";
|
||||
passwordCommentAlert.value = '';
|
||||
comment.isCommentPassword = false;
|
||||
|
||||
// 수정
|
||||
if (lastCommentClickedButton.value === "edit") {
|
||||
|
||||
if (targetComment) {
|
||||
currentPasswordCommentId.value = null;
|
||||
password.value = '';
|
||||
passwordCommentAlert.value = '';
|
||||
|
||||
targetComment.isEditTextarea = true;
|
||||
passwordCommentAlert.value = "";
|
||||
|
||||
} else {
|
||||
alert("수정 취소를 실패했습니다.");
|
||||
}
|
||||
//삭제
|
||||
} else if (lastCommentClickedButton.value === "delete") {
|
||||
passwordCommentAlert.value = "";
|
||||
passwordCommentAlert.value = '';
|
||||
|
||||
deleteReplyComment(comment)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user