1
- import { Comment } from '@/types/types' ;
2
1
import { BoardCardModal } from '@/components/ui/BoardCard/BoardCardPackage/BoardCardModalPackage' ;
2
+ import useGetCommentList from '@/hooks/queries/useGetCommentList' ;
3
3
4
4
interface ModalBoardCardProps {
5
5
boardId : number ;
6
6
userName : string ;
7
7
imgs : string [ ] ;
8
8
content : string ;
9
- comments : Comment [ ] | undefined ;
10
9
commentsCount : number ;
11
10
likedCount : number ;
12
11
createdDate : string ;
@@ -16,11 +15,12 @@ export default function ModalBoardCard({
16
15
userName,
17
16
imgs,
18
17
content,
19
- comments,
20
18
commentsCount,
21
19
likedCount,
22
20
createdDate,
23
21
} : ModalBoardCardProps ) {
22
+ const { data : commentList , Observer } = useGetCommentList ( boardId ) ;
23
+
24
24
return (
25
25
< BoardCardModal imgs = { imgs } >
26
26
< BoardCardModal . Header userName = { userName } createdDate = { createdDate } />
@@ -31,15 +31,18 @@ export default function ModalBoardCard({
31
31
commentsCount = { commentsCount }
32
32
likedCount = { likedCount }
33
33
>
34
- { comments ?. map ( ( comment ) => (
35
- < BoardCardModal . ModalComments
36
- id = { comment . id }
37
- userName = { comment . nickname }
38
- content = { comment . content }
39
- // TODO: 유저 프로필 사진 연결!
40
- userImg = "/Feed/desktop/tempProfilePic.svg"
41
- />
42
- ) ) }
34
+ { commentList ?. pages . map ( ( page ) =>
35
+ page . content . map ( ( comment ) => (
36
+ < BoardCardModal . ModalComments
37
+ id = { comment . id }
38
+ userName = { comment . nickname }
39
+ content = { comment . content }
40
+ // TODO: 유저 프로필 사진 연결!
41
+ userImg = "/Feed/desktop/tempProfilePic.svg"
42
+ />
43
+ ) ) ,
44
+ ) }
45
+ < Observer > 로딩중...</ Observer >
43
46
</ BoardCardModal . BoardCardCommentWrapper >
44
47
</ BoardCardModal . Content >
45
48
</ BoardCardModal >
0 commit comments