Skip to content

Commit

Permalink
fix: Adapt form submit event
Browse files Browse the repository at this point in the history
  • Loading branch information
yanguoyu committed Sep 27, 2023
1 parent a97012f commit f5c7188
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/neuron-ui/src/components/DepositDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useCallback } from 'react'
import { Slider } from 'office-ui-fabric-react'
import { Trans, useTranslation } from 'react-i18next'
import TextField from 'widgets/TextField'
Expand Down Expand Up @@ -71,6 +71,16 @@ const DepositDialog = ({
})
const onConfirm = useOnDepositDialogSubmit({ onCloseDepositDialog, walletID })
const onCancel = useOnDepositDialogCancel({ onCloseDepositDialog, resetDepositValue, setIsBalanceReserved })
const onSubmit = useCallback(
(e: React.FormEvent) => {
e.preventDefault()
if (disabled) {
return
}
onConfirm()
},
[disabled, onConfirm]
)

return (
<Dialog
Expand All @@ -85,7 +95,7 @@ const DepositDialog = ({
{isDepositing ? (
<Spinner size={SpinnerSize.large} />
) : (
<form>
<form onSubmit={onSubmit}>
<label className={styles.depositValueLabel} htmlFor="depositValue">{`${t(
'nervos-dao.deposit-amount'
)}`}</label>
Expand Down

0 comments on commit f5c7188

Please sign in to comment.