fix: reads denominations config on flat style

This commit is contained in:
Mauricio Navarro Miranda 2020-05-05 03:40:14 -05:00
parent 0adecf02f0
commit a73b49ef29

View file

@ -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`]
}
}))
)
})