only close modal if deposit/withdraw is successful
This commit is contained in:
parent
13cdf408ef
commit
1a1e4bab9d
|
@ -137,6 +137,8 @@ function DepositForm({ onSuccess, token }: DepositFormProps) {
|
|||
|
||||
await actions.reloadMangoAccount()
|
||||
actions.fetchWalletTokens(wallet!.adapter as unknown as Wallet)
|
||||
setSubmitting(false)
|
||||
onSuccess()
|
||||
} catch (e: any) {
|
||||
notify({
|
||||
title: 'Transaction failed',
|
||||
|
@ -145,9 +147,7 @@ function DepositForm({ onSuccess, token }: DepositFormProps) {
|
|||
type: 'error',
|
||||
})
|
||||
console.error('Error depositing:', e)
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
onSuccess()
|
||||
}
|
||||
}, [bank, wallet, inputAmount])
|
||||
|
||||
|
|
|
@ -98,13 +98,14 @@ const TopBar = () => {
|
|||
{/* <div className="px-3 md:px-4">
|
||||
<ThemeSwitcher />
|
||||
</div> */}
|
||||
<Button
|
||||
disabled={!connected}
|
||||
onClick={() => setShowDepositWithdrawModal(true)}
|
||||
secondary
|
||||
className="mx-4"
|
||||
>{`${t('deposit')} / ${t('withdraw')}`}</Button>
|
||||
{connected ? (
|
||||
<div className="flex items-center pr-4 md:pr-0">
|
||||
<Button
|
||||
onClick={() => setShowDepositWithdrawModal(true)}
|
||||
secondary
|
||||
className="mx-4"
|
||||
>{`${t('deposit')} / ${t('withdraw')}`}</Button>
|
||||
<button
|
||||
className="hidden h-16 border-l border-th-bkg-3 px-4 md:block"
|
||||
id="account-step-two"
|
||||
|
|
|
@ -101,7 +101,9 @@ function WithdrawForm({ onSuccess, token }: WithdrawFormProps) {
|
|||
type: 'success',
|
||||
txid: tx,
|
||||
})
|
||||
actions.reloadMangoAccount()
|
||||
await actions.reloadMangoAccount()
|
||||
setSubmitting(false)
|
||||
onSuccess()
|
||||
} catch (e: any) {
|
||||
console.error(e)
|
||||
notify({
|
||||
|
@ -110,9 +112,7 @@ function WithdrawForm({ onSuccess, token }: WithdrawFormProps) {
|
|||
txid: e?.txid,
|
||||
type: 'error',
|
||||
})
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
onSuccess()
|
||||
}
|
||||
}, [bank, inputAmount])
|
||||
|
||||
|
|
Loading…
Reference in New Issue