@@ -556,20 +556,19 @@ export class LSFWrapper {
556
556
const exitStream = this . shouldExitStream ( ) ;
557
557
const loadNext = exitStream ? false : this . shouldLoadNext ( ) ;
558
558
559
- await this . submitCurrentAnnotation ( "submitAnnotation" , async ( taskID , body ) => {
559
+ const result = await this . submitCurrentAnnotation ( "submitAnnotation" , async ( taskID , body ) => {
560
560
return await this . datamanager . apiCall (
561
561
"submitAnnotation" ,
562
562
{ taskID } ,
563
563
{ body } ,
564
564
// don't react on duplicated annotations error
565
565
{ errorHandler : result => result . status === 409 } ,
566
- ) . then ( result => {
567
- const status = result . $meta ?. status ;
568
-
569
- if ( status === 200 || status === 201 ) return this . datamanager . invoke ( "toast" , { message : "Annotation saved successfully" , type : "info" } ) ;
570
- else if ( status !== undefined ) return this . datamanager . invoke ( "toast" , { message : "There was an error saving your Annotation" , type : "error" } ) ;
571
- } ) ;
566
+ ) ;
572
567
} , false , loadNext , exitStream ) ;
568
+ const status = result . $meta ?. status ;
569
+
570
+ if ( status === 200 || status === 201 ) this . datamanager . invoke ( "toast" , { message : "Annotation saved successfully" , type : "info" } ) ;
571
+ else if ( status !== undefined ) this . datamanager . invoke ( "toast" , { message : "There was an error saving your Annotation" , type : "error" } ) ;
573
572
} ;
574
573
575
574
/** @private */
@@ -592,13 +591,12 @@ export class LSFWrapper {
592
591
{
593
592
body : serializedAnnotation ,
594
593
} ,
595
- ) . then ( result => {
596
- const status = result ?. $meta ?. status ;
597
-
598
- if ( status === 200 || status === 201 ) return this . datamanager . invoke ( "toast" , { message : "Annotation updated successfully" , type : "info" } ) ;
599
- else if ( status !== undefined ) return this . datamanager . invoke ( "toast" , { message : "There was an error updating your Annotation" , type : "error" } ) ;
600
- } ) ;
594
+ ) ;
601
595
} ) ;
596
+ const status = result ?. $meta ?. status ;
597
+
598
+ if ( status === 200 || status === 201 ) this . datamanager . invoke ( "toast" , { message : "Annotation updated successfully" , type : "info" } ) ;
599
+ else if ( status !== undefined ) this . datamanager . invoke ( "toast" , { message : "There was an error updating your Annotation" , type : "error" } ) ;
602
600
603
601
this . datamanager . invoke ( "updateAnnotation" , ls , annotation , result ) ;
604
602
@@ -853,6 +851,7 @@ export class LSFWrapper {
853
851
} else {
854
852
await this . loadTask ( ) ;
855
853
}
854
+ return result ;
856
855
}
857
856
858
857
/** @private */
0 commit comments