fix bug in repay modal
This commit is contained in:
parent
f4871fe8d2
commit
a353be17ff
|
@ -105,13 +105,15 @@ function RepayModal({ isOpen, onClose, token }: ModalCombinedProps) {
|
|||
setShowTokenList(false)
|
||||
}
|
||||
|
||||
const handleDeposit = useCallback(async () => {
|
||||
const handleDeposit = useCallback(
|
||||
async (amount: string) => {
|
||||
const client = mangoStore.getState().client
|
||||
const group = mangoStore.getState().group
|
||||
const actions = mangoStore.getState().actions
|
||||
const mangoAccount = mangoStore.getState().mangoAccount.current
|
||||
|
||||
if (!mangoAccount || !group || !bank || !wallet) return
|
||||
console.log('inputAmount: ', amount)
|
||||
|
||||
try {
|
||||
setSubmitting(true)
|
||||
|
@ -119,7 +121,7 @@ function RepayModal({ isOpen, onClose, token }: ModalCombinedProps) {
|
|||
group,
|
||||
mangoAccount,
|
||||
bank.mint,
|
||||
parseFloat(inputAmount)
|
||||
parseFloat(amount)
|
||||
)
|
||||
notify({
|
||||
title: 'Transaction confirmed',
|
||||
|
@ -141,7 +143,9 @@ function RepayModal({ isOpen, onClose, token }: ModalCombinedProps) {
|
|||
}
|
||||
|
||||
onClose()
|
||||
}, [bank, wallet])
|
||||
},
|
||||
[bank, wallet]
|
||||
)
|
||||
|
||||
const banks = useMemo(() => {
|
||||
const banks =
|
||||
|
@ -295,7 +299,7 @@ function RepayModal({ isOpen, onClose, token }: ModalCombinedProps) {
|
|||
</div>
|
||||
</div>
|
||||
<Button
|
||||
onClick={handleDeposit}
|
||||
onClick={() => handleDeposit(inputAmount)}
|
||||
className="flex w-full items-center justify-center"
|
||||
disabled={!inputAmount || showInsufficientBalance}
|
||||
size="large"
|
||||
|
|
Loading…
Reference in New Issue