File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,8 @@ export function useCreateDataSourceViewDocument(
118
118
disabled : true ,
119
119
} ) ;
120
120
121
+ const sendNotification = useSendNotification ( ) ;
122
+
121
123
const doCreate = async ( body : PostDataSourceWithNameDocumentRequestBody ) => {
122
124
const createUrl = `/api/w/${ owner . sId } /spaces/${ dataSourceView . spaceId } /data_sources/${ dataSourceView . dataSource . sId } /documents` ;
123
125
const res = await fetch ( createUrl , {
@@ -129,11 +131,21 @@ export function useCreateDataSourceViewDocument(
129
131
} ) ;
130
132
if ( ! res . ok ) {
131
133
const errorData = await getErrorFromResponse ( res ) ;
132
- console . error ( "Error creating document" , errorData ) ;
134
+ sendNotification ( {
135
+ type : "error" ,
136
+ title : "Failed to create document" ,
137
+ description : `Error: ${ errorData . message } ` ,
138
+ } ) ;
133
139
return null ;
134
140
} else {
135
141
void mutateContentNodes ( ) ;
136
142
143
+ sendNotification ( {
144
+ type : "success" ,
145
+ title : "Document created" ,
146
+ description : "Document has been created" ,
147
+ } ) ;
148
+
137
149
const response : PostDocumentResponseBody = await res . json ( ) ;
138
150
return response . document ;
139
151
}
You can’t perform that action at this time.
0 commit comments