refactor: async/await to then and log removal
This commit is contained in:
parent
3281df1a91
commit
ad29650c36
1 changed files with 4 additions and 5 deletions
|
|
@ -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' }))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue