refactor lbrytv web server
This commit is contained in:
parent
eedaf56ee0
commit
6ad31a3ce9
598 changed files with 6919 additions and 2317 deletions
ui/util
20
ui/util/form-validation.js
Normal file
20
ui/util/form-validation.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
// @flow
|
||||
import { regexAddress } from 'lbry-redux';
|
||||
|
||||
type DraftTxValues = {
|
||||
address: string,
|
||||
// amount: number
|
||||
};
|
||||
|
||||
export const validateSendTx = (formValues: DraftTxValues) => {
|
||||
const { address } = formValues;
|
||||
const errors = {};
|
||||
|
||||
// All we need to check is if the address is valid
|
||||
// If values are missing, users wont' be able to submit the form
|
||||
if (!process.env.NO_ADDRESS_VALIDATION && !regexAddress.test(address)) {
|
||||
errors.address = __('Not a valid LBRY address');
|
||||
}
|
||||
|
||||
return errors;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue