Stop loss and Take profit using futures api (javascript)

Hey, I’m trying to make a code that sends a stop loss and a take profit, I couldn’t find a way to do so, so I’m making 2 additional orders (one is take profit and one is stop loss).

The problem is that I’m not sure how I can cancel the other order when one is filled, anyone knows a way to do so?