This commit is contained in:
kimdaae328 2025-02-18 10:21:22 +09:00
parent c65fc7f3a5
commit 25ae933ebe
2 changed files with 12 additions and 16 deletions

View File

@ -46,7 +46,7 @@
/>
<button class="btn btn-primary" @click="$emit('submitPassword', password)">확인</button>
</div>
<span v-if="passwordAlert" class="invalid-feedback d-block text-start">{{ passwordAlert }}</span>
<span v-if="props.passwordAlert" class="invalid-feedback d-block text-start">{{ props.passwordAlert }}</span>
</div>
</div>
</div>
@ -54,8 +54,6 @@
<script setup>
import { ref, defineProps, defineEmits } from 'vue';
import { useRouter } from 'vue-router';
import axios from '@api';
import DeleteButton from '../button/DeleteBtn.vue';
import EditButton from '../button/EditBtn.vue';
import BoardRecommendBtn from '../button/BoardRecommendBtn.vue';
@ -113,10 +111,14 @@ const props = defineProps({
isPassword: {
type: Boolean,
default: false,
},
passwordAlert: {
type: String,
default: false,
}
});
const emit = defineEmits(['togglePasswordInput', 'updateReaction', 'editClick', 'deleteClick']);
const emit = defineEmits(['togglePasswordInput', 'updateReaction', 'editClick', 'deleteClick', 'updatePasswordAlert']);
//
const editClick = () => {
@ -141,6 +143,7 @@ const handleUpdateReaction = (reactionData) => {
});
};
</script>
<style scoped>

View File

@ -15,6 +15,7 @@
:date="formattedBoardDate"
:isLike="false"
:isPassword="isPassword"
:passwordAlert="passwordAlert"
@editClick="editClick"
@deleteClick="deleteClick"
@submitPassword="submitPassword"
@ -141,11 +142,6 @@ const isPassword = ref(false);
const lastClickedButton = ref("");
const toggleEdit = (commentId, state) => {
console.log(`📝 댓글???? ${commentId} 수정 모드?????: ${state}`);
isEditTextarea.value = { ...isEditTextarea.value, [commentId]: state };
};
//
const fetchBoardDetails = async () => {
try {
@ -280,26 +276,23 @@ const handleCommentReply = async (reply) => {
});
if (response.status === 200) {
console.log('대댓글 작성 성공!!!!!!:', response.data.message);
console.log('대댓글 작성 성공:', response.data.message);
await fetchComments();
} else {
console.error('대댓글 작성 실패ㅜㅜㅜ:', response.data.message);
console.error('대댓글 작성 실패:', response.data.message);
}
}
const editClick = (unknown) => {
console.log('handleEdit 실행됨! unknown', unknown);
if (unknown) {
togglePassword("edit");
} else {
console.log("🚀 BoardEdit 페이지로 이동! ID:", currentBoardId.value);
router.push({ name: "BoardEdit", params: { id: currentBoardId.value } });
}
};
const deleteClick = (unknown) => {
console.log('handleDelete 실행됨! unknown', unknown);
if (unknown) {
togglePassword("delete");
} else {
@ -318,6 +311,7 @@ const togglePassword = (button) => {
const submitPassword = async (inputPassword) => {
console.log(inputPassword)
if (!inputPassword) {
passwordAlert.value = "비밀번호를 입력해주세요.";
return;
@ -333,12 +327,11 @@ const submitPassword = async (inputPassword) => {
if (postResponse.data.code === 200 && postResponse.data.data === true) {
isPassword.value = false;
passwordAlert.value = "";
if (lastClickedButton.value === "edit") {
console.log("🔄 게시글 수정 페이지로 이동");
router.push({ name: "BoardEdit", params: { id: currentBoardId.value } });
} else if (lastClickedButton.value === "delete") {
console.log("🗑 게시글 삭제 로직 실행");
await deletePost();
}
lastClickedButton.value = null;