From 7059edc2177e1afdc28a9000446300ae30993c81 Mon Sep 17 00:00:00 2001 From: "DESKTOP-APEQLA2\\NOSEL" Date: Wed, 19 Jun 2024 17:37:16 +0700 Subject: [PATCH] ud --- src/app/get-aura/deposit.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/get-aura/deposit.tsx b/src/app/get-aura/deposit.tsx index e217011..da9bf23 100644 --- a/src/app/get-aura/deposit.tsx +++ b/src/app/get-aura/deposit.tsx @@ -18,9 +18,8 @@ function Deposit() { const { handleSubmit, - getValues, + setValue, control, - reset, formState: { errors }, } = useForm(); @@ -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) => { @@ -157,7 +157,7 @@ function Deposit() { rules={{ required: true, pattern: { - value: /\d+\.\d+/, + value: /\d+\.?\d+/, message: "Amount must be a positive number", }, }}