Merge branch 'boardmodify3'
This commit is contained in:
commit
61935cfb68
@ -157,7 +157,7 @@
|
|||||||
const toastStore = useToastStore();
|
const toastStore = useToastStore();
|
||||||
const currentBoardId = ref(Number(route.params.id));
|
const currentBoardId = ref(Number(route.params.id));
|
||||||
const unknown = computed(() => profileName.value === '익명');
|
const unknown = computed(() => profileName.value === '익명');
|
||||||
const currentUserId = computed(() => userStore.user.id); // 현재 로그인한 사용자 id
|
const currentUserId = computed(() => userStore?.user?.id); // 현재 로그인한 사용자 id
|
||||||
const authorId = ref(''); // 작성자 id
|
const authorId = ref(''); // 작성자 id
|
||||||
|
|
||||||
const isAuthor = computed(() => currentUserId.value === authorId.value);
|
const isAuthor = computed(() => currentUserId.value === authorId.value);
|
||||||
@ -233,7 +233,6 @@
|
|||||||
};
|
};
|
||||||
// 게시물 상세 데이터 불러오기
|
// 게시물 상세 데이터 불러오기
|
||||||
const fetchBoardDetails = async () => {
|
const fetchBoardDetails = async () => {
|
||||||
try {
|
|
||||||
const response = await axios.get(`board/${currentBoardId.value}`);
|
const response = await axios.get(`board/${currentBoardId.value}`);
|
||||||
const data = response.data.data;
|
const data = response.data.data;
|
||||||
|
|
||||||
@ -248,9 +247,6 @@
|
|||||||
attachment.value = data.hasAttachment || null;
|
attachment.value = data.hasAttachment || null;
|
||||||
commentNum.value = data.commentCount || 0;
|
commentNum.value = data.commentCount || 0;
|
||||||
attachments.value = data.attachments || [];
|
attachments.value = data.attachments || [];
|
||||||
} catch (error) {
|
|
||||||
alert('게시물 데이터를 불러오는 중 오류가 발생했습니다.');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 좋아요, 싫어요
|
// 좋아요, 싫어요
|
||||||
@ -280,7 +276,6 @@
|
|||||||
const handleCommentReaction = async ({ boardId, commentId, isLike, isDislike }) => {
|
const handleCommentReaction = async ({ boardId, commentId, isLike, isDislike }) => {
|
||||||
if (!commentId) return; // 댓글 ID가 없으면 실행 안 함
|
if (!commentId) return; // 댓글 ID가 없으면 실행 안 함
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await axios.post(`/board/${boardId}/${commentId}/reaction`, {
|
const response = await axios.post(`/board/${boardId}/${commentId}/reaction`, {
|
||||||
LOCBRDSEQ: boardId, // 게시글 ID
|
LOCBRDSEQ: boardId, // 게시글 ID
|
||||||
LOCCMTSEQ: commentId, // 댓글 ID
|
LOCCMTSEQ: commentId, // 댓글 ID
|
||||||
@ -289,14 +284,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
await fetchComments();
|
await fetchComments();
|
||||||
} catch (error) {
|
|
||||||
alert('오류가 발생했습니다.');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 댓글 목록 조회
|
// 댓글 목록 조회
|
||||||
const fetchComments = async (page = 1) => {
|
const fetchComments = async (page = 1) => {
|
||||||
try {
|
|
||||||
// 댓글
|
// 댓글
|
||||||
const response = await axios.get(`board/${currentBoardId.value}/comments`, {
|
const response = await axios.get(`board/${currentBoardId.value}/comments`, {
|
||||||
params: {
|
params: {
|
||||||
@ -368,9 +359,6 @@
|
|||||||
navigateFirstPage: response.data.data.navigateFirstPage, // 페이지네이션에서 첫 페이지 번호
|
navigateFirstPage: response.data.data.navigateFirstPage, // 페이지네이션에서 첫 페이지 번호
|
||||||
navigateLastPage: response.data.data.navigateLastPage, // 페이지네이션에서 마지막 페이지 번호
|
navigateLastPage: response.data.data.navigateLastPage, // 페이지네이션에서 마지막 페이지 번호
|
||||||
};
|
};
|
||||||
} catch (error) {
|
|
||||||
alert('오류가 발생했습니다.');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 댓글 작성
|
// 댓글 작성
|
||||||
@ -453,7 +441,7 @@
|
|||||||
|
|
||||||
// 게시글 삭제 버튼 클릭
|
// 게시글 삭제 버튼 클릭
|
||||||
const deleteClick = unknown => {
|
const deleteClick = unknown => {
|
||||||
if (unknown) {
|
if (unknown.value) {
|
||||||
togglePassword('delete');
|
togglePassword('delete');
|
||||||
} else {
|
} else {
|
||||||
deletePost();
|
deletePost();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user