Skip to content

Commit

Permalink
ud
Browse files Browse the repository at this point in the history
  • Loading branch information
sonln99 committed Jun 19, 2024
1 parent d770998 commit 7059edc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/get-aura/deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ function Deposit() {

const {
handleSubmit,
getValues,
setValue,
control,
reset,
formState: { errors },
} = useForm();

Expand All @@ -31,8 +30,9 @@ function Deposit() {
const _amount = formatUnits(balance?.data?.value as bigint, 18);

const addMaxAmount = () => {
const values = getValues();
reset({ ...values, amount: _amount });
if (_amount && Number(_amount) && Number(_amount) > 0) {
setValue("amount", Number(_amount));
}
};

const onSubmit = async (data: any) => {
Expand Down Expand Up @@ -157,7 +157,7 @@ function Deposit() {
rules={{
required: true,
pattern: {
value: /\d+\.\d+/,
value: /\d+\.?\d+/,
message: "Amount must be a positive number",
},
}}
Expand Down

0 comments on commit 7059edc

Please sign in to comment.