Skip to content

Commit 6bcd211

Browse files
committed
chore: req, res 타입 수정
1 parent 897f180 commit 6bcd211

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

frontend/src/api/page.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,36 @@ export type Page = {
88
content: JSONContent;
99
};
1010

11+
export type CreatePageRequest = {
12+
title: string;
13+
content: JSONContent;
14+
x: number;
15+
y: number;
16+
};
17+
1118
export type PageRequest = {
1219
title: string;
1320
content: JSONContent;
1421
};
1522

23+
export const getPage = async (id: number) => {
24+
const url = `/page/${id}`;
25+
26+
const res = await Get<Page>(url);
27+
return res.data;
28+
};
29+
1630
export const getPages = async () => {
1731
const url = "/page";
1832

1933
const res = await Get<Page[]>(url);
2034
return res.data;
2135
};
2236

23-
export const createPage = async (id: number, pageData: PageRequest) => {
24-
const url = `/page/${id}`;
37+
export const createPage = async (pageData: CreatePageRequest) => {
38+
const url = `/page`;
2539

26-
const res = await Post<null, PageRequest>(url, pageData);
40+
const res = await Post<null, CreatePageRequest>(url, pageData);
2741
return res.data;
2842
};
2943

0 commit comments

Comments
 (0)