File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,10 @@ class PositionBlotter extends Component {
23
23
orderId : order . orderId ,
24
24
} ;
25
25
console . log ( "input order to be sent: " , inputOrder ) ;
26
- if ( order . status !== "OPEN" ) return ;
26
+ const actionUrl =
27
+ order . status === "CANCELLED" ? "/orders/undocancel" : "/orders/cancel" ;
27
28
/* Post Order to server */
28
- fetch ( baseUrl + "/orders/cancel" , {
29
+ fetch ( baseUrl + actionUrl , {
29
30
method : "POST" ,
30
31
mode : "cors" ,
31
32
cache : "no-cache" ,
@@ -86,8 +87,8 @@ class PositionBlotter extends Component {
86
87
//check if valid message
87
88
const { orders } = this . state ;
88
89
const orderId = msg . orderId ;
89
- if ( "OPEN" === msg . status ) {
90
- //new trade
90
+ const found = orders . find ( ( order ) => order . orderId === orderId ) ;
91
+ if ( ! found ) {
91
92
this . setState ( { orders : [ msg , ...orders ] } ) ;
92
93
} else {
93
94
//Edited trade
You can’t perform that action at this time.
0 commit comments