Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showing nfc error on form #364

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion portal/src/pages/dashboard/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const schema = yup.object().shape({
*/
export const StepWithQRCode: React.FC<{ onBack: () => void; onFinish: () => void }> = ({ onBack, onFinish }) => {
const family = useSelector<AppState, Family | null | undefined>((state) => state.familyReducer.item);
const consumptionError = useSelector<AppState, Error | undefined>((state) => state.consumptionReducer.error);
const loading = useSelector<AppState, boolean>((state) => state.consumptionReducer.loading);
const [showQRModal, setQRModal] = React.useState<boolean>(false);

Expand Down Expand Up @@ -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 (
<Form layout="vertical" onSubmitCapture={handleSubmit}>
{status && <Alert message="Erro no formulário" description={status} type="error" />}
{status && (
<Alert
message="Erro no formulário"
description={consumptionError ? consumptionError.message : status}
type="error"
/>
)}
<Form.Item>
<Typography.Text style={PriceLabelStyle}>{'Saldo disponível: '}</Typography.Text>
<Typography.Text style={PriceStyle}>{`R$${(family?.balance || 0)
Expand Down
1 change: 1 addition & 0 deletions portal/src/redux/consumption/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down