From 3b5fb01a20b7e223ef15fdb3cadedc6816904aa1 Mon Sep 17 00:00:00 2001 From: Nikola Ubavic <53820106+ubavic@users.noreply.github.com> Date: Fri, 22 Oct 2021 14:02:36 +0200 Subject: [PATCH] fix: `wasCashboxEmptied` depends on state refactor: `wasCashboxEmptied` and `cashbox` moved to the if block --- .../src/pages/Maintenance/Wizard/Wizard.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/new-lamassu-admin/src/pages/Maintenance/Wizard/Wizard.js b/new-lamassu-admin/src/pages/Maintenance/Wizard/Wizard.js index b925cbe6..82b4af7a 100644 --- a/new-lamassu-admin/src/pages/Maintenance/Wizard/Wizard.js +++ b/new-lamassu-admin/src/pages/Maintenance/Wizard/Wizard.js @@ -38,12 +38,16 @@ const Wizard = ({ machine, cashoutSettings, locale, onClose, save, error }) => { const isLastStep = step === LAST_STEP const onContinue = it => { - const wasCashboxEmptied = it?.wasCashboxEmptied === 'YES' - - const cashbox = wasCashboxEmptied ? 0 : machine?.cashbox - const newConfig = R.merge(config, it) + if (isLastStep) { + const wasCashboxEmptied = [ + config?.wasCashboxEmptied, + it?.wasCashboxEmptied + ].includes('YES') + + const cashbox = wasCashboxEmptied ? 0 : machine?.cashbox + if (wasCashboxEmptied) { createBatch({ variables: {