fix: wasCashboxEmptied depends on state
refactor: `wasCashboxEmptied` and `cashbox` moved to the if block
This commit is contained in:
parent
ff474ee507
commit
3b5fb01a20
1 changed files with 8 additions and 4 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue