import React, { useEffect, useState } from 'react' import ProductItem from './ProductItem' import { useMessage } from '@/hooks/useMessage' import Image from 'next/image' import dayjs from 'dayjs' import { useAxios } from '@/hooks/useAxios' import { useRecoilValue } from 'recoil' import { useRouter } from 'next/navigation' import { globalLocaleStore } from '@/store/localeAtom' import { queryStringFormatter } from '@/util/common-utils' export default function MainContents({ objectList, businessCharger, businessChargerMail, businessChargerTel }) { const { getMessage } = useMessage() const router = useRouter() const globalLocaleState = useRecoilValue(globalLocaleStore) const { get } = useAxios(globalLocaleState) //공지사항 const [recentNoticeList, setRecentNoticeList] = useState([]) //FAQ const [recentFaqList, setRecentFaqList] = useState([]) useEffect(() => { fetchNoticeList() fetchFaqList() }, []) //공지사항 호출 const fetchNoticeList = async () => { try { const param = { schNoticeTpCd: 'QC', schNoticeClsCd: 'NOTICE', startRow: 1, endRow: 1, } const noticeApiUrl = `api/board/list?${queryStringFormatter(param)}` const res = await get({ url: noticeApiUrl }) //console.log('공지res::', res) if (res) { if (res.data.length > 0) { setRecentNoticeList(res.data) } } } catch (error) { console.error('NOTICE fetching error:', error) } } //FAQ 호출 const fetchFaqList = async () => { try { const param = { schNoticeTpCd: 'QC', schNoticeClsCd: 'FAQ', startRow: 1, endRow: 3, } const faqApiUrl = `api/board/list?${queryStringFormatter(param)}` const res = await get({ url: faqApiUrl }) //console.log('FAQres::', res) if (res) { if (res.data.length > 0) { setRecentFaqList(res.data) } } } catch (error) { console.error('FAQ fetching error:', error) } } return (