commit f724484ccf1e193f28c38159bb12ef8fd896b724
parent adca37fc98a4a4a815321ad7af74e1bdcee8a9a6
Author: Sebastian <sebasjm@gmail.com>
Date: Sun, 27 Apr 2025 10:09:10 -0300
add missing check in validator
Diffstat:
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/packages/aml-backoffice-ui/src/pages/Search.tsx b/packages/aml-backoffice-ui/src/pages/Search.tsx
@@ -560,9 +560,11 @@ const genericFields: (
help: i18n.str`As defined by RFC 8905`,
placeholder: i18n.str`payto://`,
validator(value) {
- return value && parsePaytoUri(value) === undefined
- ? i18n.str`invalid`
- : undefined;
+ return !value
+ ? i18n.str`required`
+ : parsePaytoUri(value) === undefined
+ ? i18n.str`invalid`
+ : undefined;
},
},
];
@@ -591,11 +593,13 @@ const walletFields: (i18n: InternationalizationAPI) => UIFormElementConfig[] = (
help: i18n.str`Exchange hostname`,
placeholder: i18n.str`exchange.taler.net`,
validator(value) {
- return !DOMAIN_REGEX.test(value)
- ? i18n.str`Invalid hostname`
- : value.endsWith("/")
- ? i18n.str`remove last '/'`
- : undefined;
+ return !value
+ ? i18n.str`required`
+ : !DOMAIN_REGEX.test(value)
+ ? i18n.str`Invalid hostname`
+ : value.endsWith("/")
+ ? i18n.str`remove last '/'`
+ : undefined;
},
},
{
@@ -606,9 +610,11 @@ const walletFields: (i18n: InternationalizationAPI) => UIFormElementConfig[] = (
help: i18n.str`Wallet reserve public key`,
placeholder: i18n.str`abcdef1235`,
validator(value) {
- return value && value.length !== 52
- ? i18n.str`Should be 52 characters`
- : undefined;
+ return !value
+ ? i18n.str`required`
+ : value.length !== 52
+ ? i18n.str`Should be 52 characters`
+ : undefined;
},
},
];
@@ -632,7 +638,11 @@ const talerBankFields: (
help: i18n.str`Without the scheme, may include subpath: bank.com, bank.com/path/`,
placeholder: i18n.str`bank.demo.taler.net`,
validator: (value) =>
- !DOMAIN_REGEX.test(value) ? i18n.str`Invalid hostname` : undefined,
+ !value
+ ? i18n.str`required`
+ : !DOMAIN_REGEX.test(value)
+ ? i18n.str`Invalid hostname`
+ : undefined,
},
];