File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,13 +200,17 @@ export default defineContentScript({
200200 submitBtn . textContent = 'Posting...' ;
201201
202202 try {
203- await sendMessage ( 'createAnnotation' , {
203+ const res = await sendMessage ( 'createAnnotation' , {
204204 url : window . location . href ,
205205 title : document . title ,
206206 text,
207207 selector : { type : 'TextQuoteSelector' , exact : quoteText } ,
208208 } ) ;
209209
210+ if ( ! res . success ) {
211+ throw new Error ( res . error || 'Unknown error' ) ;
212+ }
213+
210214 showToast ( 'Annotation created!' , 'success' ) ;
211215 composeModal ?. remove ( ) ;
212216 composeModal = null ;
Original file line number Diff line number Diff line change @@ -132,13 +132,10 @@ export async function createAnnotation(data: {
132132 const res = await apiRequest ( '/annotations' , {
133133 method : 'POST' ,
134134 body : JSON . stringify ( {
135- target : {
136- source : data . url ,
137- selector : data . selector ,
138- } ,
139- body : { type : 'TextualBody' , value : data . text , format : 'text/plain' } ,
140- motivation : 'commenting' ,
135+ url : data . url ,
136+ text : data . text ,
141137 title : data . title ,
138+ selector : data . selector ,
142139 } ) ,
143140 } ) ;
144141
You can’t perform that action at this time.
0 commit comments