From a73b49ef291ebc72db64d9a17e6c392d2dcf685d Mon Sep 17 00:00:00 2001 From: Mauricio Navarro Miranda Date: Tue, 5 May 2020 03:40:14 -0500 Subject: [PATCH] fix: reads denominations config on flat style --- .../src/pages/maintenance/Cashboxes.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/new-lamassu-admin/src/pages/maintenance/Cashboxes.js b/new-lamassu-admin/src/pages/maintenance/Cashboxes.js index 2cf0f07e..214f2ab2 100644 --- a/new-lamassu-admin/src/pages/maintenance/Cashboxes.js +++ b/new-lamassu-admin/src/pages/maintenance/Cashboxes.js @@ -33,6 +33,7 @@ const ValidationSchema = Yup.object().shape({ denomination: Yup.number() .required('Required') .integer() + .default(0) }), cashout2: Yup.object() .required('Required') @@ -44,6 +45,7 @@ const ValidationSchema = Yup.object().shape({ denomination: Yup.number() .required('Required') .integer() + .default(0) }) }) @@ -90,15 +92,15 @@ const Cashboxes = () => { const [machines, setMachines] = useState([]) useQuery(GET_MACHINES_AND_CONFIG, { - onCompleted: data => + onCompleted: ({ machines, config }) => setMachines( - data.machines.map(m => ({ + machines.map(m => ({ ...m, - // TODO: move this to the new flat config style - currency: data.config.fiatCurrency ?? { code: 'N/D' }, - denominations: (data.config.cashOutDenominations ?? {})[ - m.deviceId - ] || { top: 11111, bottom: 22222 } + currency: { code: config.locale_fiatCurrency ?? '' }, + denominations: { + top: config[`denominations_${m.deviceId}_top`], + bottom: config[`denominations_${m.deviceId}_bottom`] + } })) ) })