'use client'; import './style.scss'; import { useState, useEffect } from 'react'; import Link from 'next/link'; import { fetchApi, throwError, getDateTime } from '@/lib/utils/client'; import type { MyCommentsResponse } from '@/types/response/account/myComments'; import Loading from '@/app/component/Loading'; import Pagination from '@/app/component/Pagination'; import NavTabs from '../navTabs'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faThumbsUp } from '@fortawesome/free-regular-svg-icons'; export default function MyComments() { const [error, setError] = useState(''); const [loading, setLoading] = useState(true); const [page, setPage] = useState(1); const [data, setData] = useState({ total: 0, list: [] }); useEffect(() => { if (error) { alert(error); setError(''); } }, [error]); useEffect(() => { setLoading(true); fetchApi(`/api/mypage/comments?page=${page}&perPage=20`).then((res) => { throwError(res); setData(res.data!); }).catch(err => { setError(err.message); }).finally(() => { setLoading(false); }); }, [page]); return ( <>
{ loading && }

작성 댓글

합계: {data.total}
  • 번호
  • 게시판
  • 게시글
  • 댓글 내용
  • 추천
  • 작성일
{data.list.length > 0 ? ( data.list.map((row) => (
{/* PC */}
  1. {row.num}
  2. {row.boardName}
  3. {row.postSubject}
  4. {row.content}
  5. {row.likes}
  6. {getDateTime(row.createdAt)}
{/* Mobile */}
)) ) : (

작성한 댓글이 없습니다.

)}
{data.list.length > 0 && ( )}
); }