File tree Expand file tree Collapse file tree 2 files changed +22
-16
lines changed
Expand file tree Collapse file tree 2 files changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ export interface PagesResponse {
3030 pages : Omit < Page , "content" > [ ] ;
3131}
3232
33+ interface CreatePageResponse {
34+ message : string ;
35+ pageId : number ;
36+ }
37+
3338export const getPage = async ( id : number ) => {
3439 const url = `/page/${ id } ` ;
3540
@@ -47,7 +52,7 @@ export const getPages = async () => {
4752export const createPage = async ( pageData : CreatePageRequest ) => {
4853 const url = `/page` ;
4954
50- const res = await Post < null , CreatePageRequest > ( url , pageData ) ;
55+ const res = await Post < CreatePageResponse , CreatePageRequest > ( url , pageData ) ;
5156 return res . data ;
5257} ;
5358
Original file line number Diff line number Diff line change @@ -18,21 +18,22 @@ export default function Tools() {
1818 < Button
1919 className = "flex flex-row items-center gap-1 rounded-sm px-2 py-1 font-medium hover:bg-neutral-100"
2020 onClick = { ( ) => {
21- createMutation . mutate ( {
22- title : "제목 없음" ,
23- content : {
24- type : "doc" ,
25- content : [
26- {
27- type : "paragraph" ,
28- content : [ { type : "text" , text : "" } ] ,
29- } ,
30- ] ,
31- } ,
32- x : 0 ,
33- y : 0 ,
34- } ) ;
35- setCurrentPage ( pages [ pages . length - 1 ] . id ) ;
21+ createMutation
22+ . mutateAsync ( {
23+ title : "제목 없음" ,
24+ content : {
25+ type : "doc" ,
26+ content : [
27+ {
28+ type : "paragraph" ,
29+ content : [ { type : "text" , text : "" } ] ,
30+ } ,
31+ ] ,
32+ } ,
33+ x : 0 ,
34+ y : 0 ,
35+ } )
36+ . then ( ( res ) => setCurrentPage ( res . pageId ) ) ;
3637 } }
3738 >
3839 < div >
You can’t perform that action at this time.
0 commit comments