diff --git a/src/components/main/MainContents.jsx b/src/components/main/MainContents.jsx index b47fe720..b390adcd 100644 --- a/src/components/main/MainContents.jsx +++ b/src/components/main/MainContents.jsx @@ -33,15 +33,42 @@ export default function MainContents() { const { qcastState, setIsGlobalLoading } = useContext(QcastContext) const { fetchObjectList, initObjectList } = useMainContentsController() + //첨부파일 + const [boardList, setBoardList] = useState([]) useEffect(() => { fetchObjectList() fetchNoticeList() fetchFaqList() + //첨부파일 목록 호출 + fetchArchiveList() return () => { initObjectList() } }, []) + //첨부파일 목록 호출 + const fetchArchiveList = async () => { + const url = `/api/board/list` + + const params = new URLSearchParams({ + schNoticeTpCd: 'QC', + schNoticeClsCd: 'DOWN', + startRow: 1, + endRow: 2, + }) + + const apiUrl = `${url}?${params.toString()}` + const resultData = await get({ url: apiUrl }) + + if (resultData) { + if (resultData.result.code === 200) { + setBoardList(resultData.data) + } else { + alert(resultData.result.message) + } + } + } + //공지사항 호출 const fetchNoticeList = async () => { try { @@ -92,33 +119,6 @@ export default function MainContents() { const [open, setOpen] = useState(false) const [modalNoticeNo, setModalNoticeNo] = useState('') - // 메인 파일 다운로드 - const handleDetailFileListDown = async (noticeNo) => { - //396, 395테스트 - const url = `/api/board/detail` - const params = new URLSearchParams({ - noticeNo: noticeNo, - }) - - const apiUrl = `${url}?${params.toString()}` - - const resultData = await get({ url: apiUrl }) - - if (resultData) { - if (resultData.result.code === 200) { - const boardDetailFileList = resultData.data.listFile - - if (boardDetailFileList && Array.isArray(boardDetailFileList)) { - boardDetailFileList.forEach((boardFile) => { - handleFileDown(boardFile) - }) - } - } else { - swalFire({ type: 'alert', text: resultData.result.message, icon: 'error' }) - } - } - } - return (
@@ -210,20 +210,19 @@ export default function MainContents() { )} -
- - -
+ {boardList.length > 0 ? ( +
+ {boardList?.map((board) => ( + + ))} +
+ ) : ( +
+

{getMessage('common.message.no.data')}

+
+ )}