diff --git a/src/components/molecules/FormFields/Credential/index.tsx b/src/components/molecules/FormFields/Credential/index.tsx index 8906e1b19..c8cbb791e 100644 --- a/src/components/molecules/FormFields/Credential/index.tsx +++ b/src/components/molecules/FormFields/Credential/index.tsx @@ -27,18 +27,24 @@ export default function Credential(props: InputProps) { helpers.setValue(newInput) } - function handleAddValue(e: FormEvent) { - e.preventDefault() + function isCredentialValid(): boolean { if (!isAddress(value)) { toast.error('Wallet address is invalid') - return + return false } if (arrayInput.includes(value)) { toast.error('Wallet address already added into list') - return + return false + } + return true + } + + function handleAddValue(e: FormEvent) { + e.preventDefault() + if (isCredentialValid()) { + setArrayInput((arrayInput) => [...arrayInput, value]) + setValue('') } - setArrayInput((arrayInput) => [...arrayInput, value]) - setValue('') } return ( diff --git a/src/components/organisms/AssetActions/Edit/EditAdvanceSettings.tsx b/src/components/organisms/AssetActions/Edit/EditAdvanceSettings.tsx index 00fd691a0..a3e4ad52b 100644 --- a/src/components/organisms/AssetActions/Edit/EditAdvanceSettings.tsx +++ b/src/components/organisms/AssetActions/Edit/EditAdvanceSettings.tsx @@ -123,7 +123,7 @@ export default function EditAdvanceSettings({ {({ isSubmitting, values, initialValues }) => isSubmitting || hasFeedback ? (