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 (