@@ -5,7 +5,12 @@ interface PostBoardType {
5
5
content : string ;
6
6
}
7
7
8
- interface TempPostListApiProps {
8
+ interface PostCommentType {
9
+ boardId : number ;
10
+ parentId : number ;
11
+ content : string ;
12
+ }
13
+ interface GetListApiProps {
9
14
pageParam : number ;
10
15
pageSize : number ;
11
16
}
@@ -24,10 +29,7 @@ export async function postBoard(postBoardData: PostBoardType) {
24
29
return response . json ( ) ;
25
30
}
26
31
27
- export default async function getBoardList ( {
28
- pageParam,
29
- pageSize,
30
- } : TempPostListApiProps ) {
32
+ export async function getBoardList ( { pageParam, pageSize } : GetListApiProps ) {
31
33
try {
32
34
const url = `/endpoint/api/board/list?pageNumber=${ pageParam } &pageSize=${ pageSize } ` ;
33
35
const response = await fetch ( url ) ;
@@ -43,3 +45,34 @@ export default async function getBoardList({
43
45
throw error ;
44
46
}
45
47
}
48
+
49
+ export async function postComment ( postCommentData : PostCommentType ) {
50
+ const url = `endpoint/api/reply/register` ;
51
+
52
+ const response = await fetch ( url , {
53
+ method : 'POST' ,
54
+ credentials : 'include' ,
55
+ headers : {
56
+ 'Content-Type' : 'application/json' ,
57
+ } ,
58
+ body : JSON . stringify ( postCommentData ) ,
59
+ } ) ;
60
+ return response . json ( ) ;
61
+ }
62
+
63
+ // export async function getCommentList({ pageParam, pageSize }: GetListApiProps) {
64
+ // try {
65
+ // const url = `/endpoint/api/reply/list?pageNumber=${pageParam}&pageSize=${pageSize}`;
66
+ // const response = await fetch(url);
67
+ // if (!response.ok) {
68
+ // throw new Error(`서버오류:${response.status}`);
69
+ // }
70
+ // return await response.json();
71
+ // } catch (error) {
72
+ // if (error instanceof AuthError) {
73
+ // window.location.replace('/auth/login');
74
+ // alert(error.message);
75
+ // }
76
+ // throw error;
77
+ // }
78
+ // }
0 commit comments