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