fix: empty form should not allow the "send" button

This commit is contained in:
Sebastian 2022-12-07 09:30:01 -03:00
parent 54c8d0db31
commit 7061127c07
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1

View File

@ -916,23 +916,21 @@ function PaytoWireTransfer(Props: any): VNode {
// submitData.amount === "" // submitData.amount === ""
let parsedAmount = undefined; let parsedAmount = undefined;
const errorsWire = !submitData const errorsWire = {
? undefined iban: !submitData?.iban
: undefinedIfEmpty({
iban: !submitData.iban
? i18n.str`Missing IBAN` ? i18n.str`Missing IBAN`
: !/^[A-Z0-9]*$/.test(submitData.iban) : !/^[A-Z0-9]*$/.test(submitData.iban)
? i18n.str`IBAN should have just uppercased letters and numbers` ? i18n.str`IBAN should have just uppercased letters and numbers`
: undefined, : undefined,
subject: !submitData.subject ? i18n.str`Missing subject` : undefined, subject: !submitData?.subject ? i18n.str`Missing subject` : undefined,
amount: !submitData.amount amount: !submitData?.amount
? i18n.str`Missing amount` ? i18n.str`Missing amount`
: !(parsedAmount = Amounts.parse(`${currency}:${submitData.amount}`)) : !(parsedAmount = Amounts.parse(`${currency}:${submitData.amount}`))
? i18n.str`Amount is not valid` ? i18n.str`Amount is not valid`
: Amounts.isZero(parsedAmount) : Amounts.isZero(parsedAmount)
? i18n.str`Should be greater than 0` ? i18n.str`Should be greater than 0`
: undefined, : undefined,
}); };
if (!pageState.isRawPayto) if (!pageState.isRawPayto)
return ( return (