Skip to content

Commit

Permalink
Fix: 요청 주제관리 수정 로직 일부 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Nahyun-Kang committed Dec 15, 2024
1 parent 7f27b29 commit a28d20c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
20 changes: 13 additions & 7 deletions src/app/admin/topics/_components/AdminTopicBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
// }),
});

Expand All @@ -31,7 +35,7 @@ function TopicBox({ topic }: TopicBoxProps) {
};

const handleToggleExposeButton = () => {
// editTopicMutation()
editTopicMutation.mutate();
};

return (
Expand Down Expand Up @@ -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}
/>
)}
</>
Expand Down
6 changes: 4 additions & 2 deletions src/app/admin/topics/_components/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -38,6 +39,7 @@ function BottomSheet({ onClose, topicTitle, category, isExposed }: BottomSheetPr
const editTopicMutation = useMutation({
// mutationFn: () =>
// editAdminTopic({
// topicId
// isExposed,
// title,
// categoryCode,
Expand Down Expand Up @@ -131,7 +133,7 @@ function BottomSheet({ onClose, topicTitle, category, isExposed }: BottomSheetPr
</div>

<button type="submit" className={styles.submitButton} disabled={!title || title.length > 30}>
요청 보내기
수정하기
</button>
</form>
</div>
Expand Down
2 changes: 0 additions & 2 deletions src/app/admin/topics/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export default function AdminTopicsPage() {
}
});

console.log(topicsData);

return (
<section>
<div className={styles.body}>
Expand Down

0 comments on commit a28d20c

Please sign in to comment.