File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff 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+
1118export 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+
1630export 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
You can’t perform that action at this time.
0 commit comments