From a28d20c251da5806acc4e60856cd6f94f4785c96 Mon Sep 17 00:00:00 2001 From: Nahyun Date: Sun, 15 Dec 2024 19:47:37 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=9A=94=EC=B2=AD=20=EC=A3=BC=EC=A0=9C?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20=EC=88=98=EC=A0=95=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=9D=BC=EB=B6=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../topics/_components/AdminTopicBox.tsx | 20 ++++++++++++------- .../admin/topics/_components/BottomSheet.tsx | 6 ++++-- src/app/admin/topics/page.tsx | 2 -- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/app/admin/topics/_components/AdminTopicBox.tsx b/src/app/admin/topics/_components/AdminTopicBox.tsx index 031e6cf2..b0b90a8b 100644 --- a/src/app/admin/topics/_components/AdminTopicBox.tsx +++ b/src/app/admin/topics/_components/AdminTopicBox.tsx @@ -7,6 +7,10 @@ import BottomSheet from './BottomSheet'; import { RequestedTopicType } from '@/lib/types/requestedTopicType'; import editAdminTopic from '@/app/_api/adminTopics/editAdminTopic'; import formatDate from '@/lib/utils/dateFormat'; +import getCategories from '@/app/_api/category/getCategories'; +import { QUERY_KEYS } from '@/lib/constants/queryKeys'; +import { CategoryType } from '@/lib/types/categoriesType'; + import * as styles from './AdminTopicBox.css'; interface TopicBoxProps { @@ -19,10 +23,10 @@ function TopicBox({ topic }: TopicBoxProps) { const editTopicMutation = useMutation({ // mutationFn: () => // editAdminTopic({ + // // topicId: topic?.id, // isExposed: !topic.isExposed, - // title, - // categoryCode, - // topicId, + // title: topic?.title, + // categoryCode: topic?.categoryKorName, // }), }); @@ -31,7 +35,7 @@ function TopicBox({ topic }: TopicBoxProps) { }; const handleToggleExposeButton = () => { - // editTopicMutation() + editTopicMutation.mutate(); }; return ( @@ -64,9 +68,11 @@ function TopicBox({ topic }: TopicBoxProps) { onClose={() => { setIsBottomSheetOpen(false); }} - topicTitle={topic.title} - category={topic.categoryKorName} - isExposed={topic.isExposed} + topicTitle={topic?.title} + category={topic?.categoryKorName} + isExposed={topic?.isExposed} + // {topicI수정필요} + topicId={0} /> )} diff --git a/src/app/admin/topics/_components/BottomSheet.tsx b/src/app/admin/topics/_components/BottomSheet.tsx index 88a50c7e..4e28306f 100644 --- a/src/app/admin/topics/_components/BottomSheet.tsx +++ b/src/app/admin/topics/_components/BottomSheet.tsx @@ -19,9 +19,10 @@ interface BottomSheetProps { topicTitle: string; category: string; isExposed: boolean; + topicId: number; } // TODO: 컴포넌트 공통화 작업 -function BottomSheet({ onClose, topicTitle, category, isExposed }: BottomSheetProps) { +function BottomSheet({ onClose, topicTitle, category, isExposed, topicId }: BottomSheetProps) { const [isDropdownOpen, setIsDropdownOpen] = useState(false); const { isOn: isModalOn, handleSetOn: openModal, handleSetOff: closeModal } = useBooleanOutput(false); @@ -38,6 +39,7 @@ function BottomSheet({ onClose, topicTitle, category, isExposed }: BottomSheetPr const editTopicMutation = useMutation({ // mutationFn: () => // editAdminTopic({ + // topicId // isExposed, // title, // categoryCode, @@ -131,7 +133,7 @@ function BottomSheet({ onClose, topicTitle, category, isExposed }: BottomSheetPr diff --git a/src/app/admin/topics/page.tsx b/src/app/admin/topics/page.tsx index 9dba1ae3..b3398936 100644 --- a/src/app/admin/topics/page.tsx +++ b/src/app/admin/topics/page.tsx @@ -50,8 +50,6 @@ export default function AdminTopicsPage() { } }); - console.log(topicsData); - return (