From ad29650c36fe6b04c5eed03dc206baa5d46a183e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Wed, 19 May 2021 14:34:56 +0100 Subject: [PATCH] refactor: async/await to then and log removal --- lib/routes/cashboxRoutes.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/routes/cashboxRoutes.js b/lib/routes/cashboxRoutes.js index c39085d7..709dc121 100644 --- a/lib/routes/cashboxRoutes.js +++ b/lib/routes/cashboxRoutes.js @@ -10,13 +10,12 @@ function notifyCashboxRemoval (req, res, next) { return getMachine(req.deviceId) .then(machine => { loadLatestConfig() - .then(async config => { + .then(config => { const cashInSettings = getCashInSettings(config) - console.log(cashInSettings) if (cashInSettings.cashboxReset === 'Automatic') { - await cashbox.createCashboxBatch(req.deviceId, machine.cashbox) - await setMachine({ deviceId: req.deviceId, action: 'emptyCashInBills' }) - return res.status(200).send({ status: 'OK' }) + return cashbox.createCashboxBatch(req.deviceId, machine.cashbox) + .then(() => setMachine({ deviceId: req.deviceId, action: 'emptyCashInBills' })) + .then(() => res.status(200).send({ status: 'OK' })) } }) })