Skip to content

Commit

Permalink
fix lint errors + new set error
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed May 20, 2024
1 parent 63ce3da commit 4aa8e8c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web-frontend/src/pages/TransferCoins/SendCoins/SendForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ export function SendForm(props: SendFormProps) {
setFees(sendOpData.fees);
setSelectedAsset(sendOpData.asset);
}
}, [sendOpData, redirectAmount, redirectedTo]);
}, [sendOpData, redirectAmount, redirectedTo, resolveDns]);

const mnsExtensionRegex = /\.massa$/;
const mnsExtension = '.massa';

function validate(formObject: IForm) {
Expand Down Expand Up @@ -146,7 +145,7 @@ export function SendForm(props: SendFormProps) {
e.preventDefault();
let formObject = parseForm(e);

if (targetMnsAddress && mnsExtensionRegex.test(recipient)) {
if (targetMnsAddress && /\.massa$/.test(recipient)) {
// recipient is a domain name
formObject = {
...formObject,
Expand Down Expand Up @@ -181,9 +180,10 @@ export function SendForm(props: SendFormProps) {

const handleRecipientChange = useCallback(
async (e: ChangeEvent<HTMLInputElement>) => {
const mnsExtensionRegex = /\.massa$/;
const value = e.target.value;
setRecipient(value);
setError({ recipient: '', amount: error?.amount });
setError((error) => ({ ...error, recipient: '' }));
if (value !== '' && mnsExtensionRegex.test(value)) {
const inputMns = value.replace(mnsExtension, '');
const targetAddress = await resolveDns(inputMns);
Expand All @@ -195,7 +195,7 @@ export function SendForm(props: SendFormProps) {
}
}
},
[recipient, resolveDns, resetTargetMnsAddress, mnsExtensionRegex],
[resolveDns, resetTargetMnsAddress],
);

return (
Expand Down

0 comments on commit 4aa8e8c

Please sign in to comment.