From 3cace1517330b89137170ca5d6665c3c597b3f6b Mon Sep 17 00:00:00 2001 From: John Micko Date: Wed, 3 Jan 2024 19:06:45 -0600 Subject: [PATCH] Fix server crashing bugs from scope issues --- server/routes/orders.router.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/routes/orders.router.js b/server/routes/orders.router.js index 57fd6fd9..0b23d24f 100644 --- a/server/routes/orders.router.js +++ b/server/routes/orders.router.js @@ -519,10 +519,10 @@ router.put('/bulkPairRatio/:product_id', rejectUnauthenticated, async (req, res) */ router.delete('/', rejectUnauthenticated, async (req, res) => { devLog('in delete all orders route'); + const userID = req.user.id; + const previousPauseStatus = req.user.paused; try { const identifier = req.headers['x-identifier']; - const userID = req.user.id; - const previousPauseStatus = req.user.paused; devLog('in delete all orders route', userID); // pause trading before cancelling all orders or it will reorder them before done, making it take longer await databaseClient.setPause(true, userID) @@ -658,8 +658,8 @@ router.delete('/product/:product_id', rejectUnauthenticated, async (req, res) => */ router.delete('/:product_id/:start/:end', rejectUnauthenticated, async (req, res) => { // devLog('in delete range route'); - devLog('in delete range route', userID, start, end); const userID = req.user.id; + devLog('in delete range route', userID); const previousPauseStatus = req.user.paused; try { const identifier = req.headers['x-identifier'];