Merge branch 'boardmodify3'

This commit is contained in:
nevermoregb 2025-03-11 15:56:55 +09:00
commit a3ea106265

View File

@ -36,7 +36,7 @@
/>
<button class="btn btn-primary" @click="submitPassword">확인</button>
</div>
<span v-if="passwordAlert" class="invalid-feedback d-block text-start">{{ passwordAlert }}</span>
<span v-if="boardPasswordAlert" class="invalid-feedback d-block text-start">{{ boardPasswordAlert }}</span>
</div>
</div>
</div>
@ -210,6 +210,7 @@
const isEditTextarea = ref(false);
const isDeleted = ref(true);
const commentAlert = ref('');
const boardPasswordAlert = ref('');
const updatePassword = newPassword => {
password.value = newPassword;
@ -368,6 +369,9 @@
//
const handleCommentSubmit = async data => {
closeAllEditTextareas();
closeAllPasswordareas();
togglePassword('close');
if (!data) {
return;
}
@ -524,6 +528,12 @@
});
};
const closeAllPasswordareas = () => {
currentPasswordCommentId.value = null; //
password.value = '';
passwordCommentAlert.value = '';
};
//
const deleteComment = async comment => {
const isMyComment = comment.authorId === currentUserId.value;
@ -556,19 +566,27 @@
};
const togglePassword = button => {
// close: .
if (button === 'close') {
isPassword.value = false;
boardPasswordAlert.value = '';
return;
}
if (lastClickedButton.value === button) {
isPassword.value = !isPassword.value;
boardPasswordAlert.value = '';
} else {
isPassword.value = true;
}
lastClickedButton.value = button;
};
//
const submitPassword = async () => {
if (!password.value.trim()) {
passwordAlert.value = '비밀번호를 입력해주세요.';
boardPasswordAlert.value = '비밀번호를 입력해주세요.';
return;
}
@ -579,7 +597,7 @@
});
if (response.data.code === 200 && response.data.data === true) {
password.value = '';
boardPasswordAlert.value = '';
isPassword.value = false;
if (lastClickedButton.value === 'edit') {
@ -589,10 +607,10 @@
}
lastClickedButton.value = null;
} else {
passwordAlert.value = '비밀번호가 일치하지 않습니다.';
boardPasswordAlert.value = '비밀번호가 일치하지 않습니다.';
}
} catch (error) {
if (error.response && error.response.status === 401) passwordAlert.value = '비밀번호가 일치하지 않습니다.';
if (error.response && error.response.status === 401) boardPasswordAlert.value = '비밀번호가 일치하지 않습니다.';
}
};
@ -700,6 +718,7 @@
//
const handleSubmitEdit = async (comment, editedContent) => {
togglePassword();
try {
const response = await axios.put(`board/comment/${comment.commentId}`, {
LOCCMTSEQ: comment.commentId,