From b596b9206f47bbe346ea1a084c98828dfe09f6f2 Mon Sep 17 00:00:00 2001 From: Alessandro Macanha Date: Fri, 12 Jun 2020 09:15:00 -0300 Subject: [PATCH] showing nfc error on form --- portal/src/pages/dashboard/form.tsx | 9 ++++++++- portal/src/redux/consumption/actions.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/portal/src/pages/dashboard/form.tsx b/portal/src/pages/dashboard/form.tsx index 825686c5..b00cb760 100644 --- a/portal/src/pages/dashboard/form.tsx +++ b/portal/src/pages/dashboard/form.tsx @@ -130,6 +130,7 @@ const schema = yup.object().shape({ */ export const StepWithQRCode: React.FC<{ onBack: () => void; onFinish: () => void }> = ({ onBack, onFinish }) => { const family = useSelector((state) => state.familyReducer.item); + const consumptionError = useSelector((state) => state.consumptionReducer.error); const loading = useSelector((state) => state.consumptionReducer.loading); const [showQRModal, setQRModal] = React.useState(false); @@ -175,7 +176,13 @@ export const StepWithQRCode: React.FC<{ onBack: () => void; onFinish: () => void const invalidConsumptionValue = !!(family && Number(values.value) > 0 && Number(values.value) > family.balance); return (
- {status && } + {status && ( + + )} {'Saldo disponível: '} {`R$${(family?.balance || 0) diff --git a/portal/src/redux/consumption/actions.ts b/portal/src/redux/consumption/actions.ts index 15cbc2bd..d02d85a2 100644 --- a/portal/src/redux/consumption/actions.ts +++ b/portal/src/redux/consumption/actions.ts @@ -51,6 +51,7 @@ export const requestSaveConsumption = ( } catch (error) { // Request failed: dispatch error logging.error(error); + error.message = error.response ? error.response.data : error.message; dispatch(doSaveConsumptionFailed(error)); if (onFailure) onFailure(error);