From f98ba270a421d0b536bc11ed6be47f60b806488f Mon Sep 17 00:00:00 2001 From: jhynsoo Date: Mon, 12 Aug 2024 09:35:15 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B8=80=20=EB=AA=A9=EB=A1=9D=200?= =?UTF-8?q?=EA=B0=9C=EC=9D=BC=20=EB=95=8C=20=ED=91=9C=EC=8B=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ArticleBoard/ArticleBoard.jsx | 3 ++- frontend/src/pages/FreeboardListPage/FreeboardListPage.jsx | 4 ++-- frontend/src/pages/NoticeListPage/NoticeListPage.jsx | 4 ++-- frontend/src/pages/QuestionListPage/QuestionListPage.jsx | 2 +- frontend/src/pages/QuizsetListPage/QuizsetListPage.jsx | 2 +- frontend/src/pages/StudentListPage/StudentListPage.jsx | 2 +- .../TeacherReportsetDetailPage/TeacherReportsetDetailPage.jsx | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/ArticleBoard/ArticleBoard.jsx b/frontend/src/components/ArticleBoard/ArticleBoard.jsx index 09fe7e5..9e8d378 100644 --- a/frontend/src/components/ArticleBoard/ArticleBoard.jsx +++ b/frontend/src/components/ArticleBoard/ArticleBoard.jsx @@ -1,6 +1,7 @@ import EditIcon from '/src/assets/icons/edit.svg?react'; import { Link } from 'react-router-dom'; import styles from './ArticleBoard.module.css'; +import { Children } from 'react'; export default function ArticleBoard({ title, canCreate, children }) { return ( @@ -19,7 +20,7 @@ export default function ArticleBoard({ title, canCreate, children }) { )}
- {children ? children :
표시할 내용이 없습니다.
} + {Children.toArray(children).length ? children :
표시할 내용이 없습니다.
}
); diff --git a/frontend/src/pages/FreeboardListPage/FreeboardListPage.jsx b/frontend/src/pages/FreeboardListPage/FreeboardListPage.jsx index 9cc6462..badfe77 100644 --- a/frontend/src/pages/FreeboardListPage/FreeboardListPage.jsx +++ b/frontend/src/pages/FreeboardListPage/FreeboardListPage.jsx @@ -7,14 +7,14 @@ import IntersectionArea from '../../components/IntersectionArea/IntersectionObse export default function NoticeListPage() { const { lectureId } = useParams(); const { data, fetchNextPage, hasNextPage } = useFreeboards(lectureId); - const articles = data?.pages.flatMap((page) => page.data); + const articles = data.pages.flatMap((page) => page.data); return ( - {articles.length && + {articles.length > 0 && articles.map?.((notice) => ( page.data); + const notices = data.pages.flatMap((page) => page.data); const userType = useBoundStore((state) => state.userType); return ( @@ -16,7 +16,7 @@ export default function NoticeListPage() { title="공지사항" canCreate={userType === 'teacher'} > - {notices.length && + {notices.length > 0 && notices.map?.((notice) => ( - {questions.length && + {questions.length > 0 && questions.map?.((question) => ( - {quizsets.length && + {quizsets.length > 0 && quizsets.map?.((quizset) => ( - {students.length && + {students.length > 0 && students.map?.((student) => { return ( - {reports.length && + {reports.length > 0 && reports.map?.((report) => { return (