Remove duplicate insufficient funds handling

This commit is contained in:
ekzyis 2023-07-22 22:38:33 +02:00
parent 28ea5ab70e
commit 773f658e00
1 changed files with 1 additions and 20 deletions

View File

@ -6,8 +6,6 @@ import { useMe } from './me'
import UpBolt from '../svgs/bolt.svg' import UpBolt from '../svgs/bolt.svg'
import { amountSchema } from '../lib/validate' import { amountSchema } from '../lib/validate'
import { useAnonymous } from '../lib/anonymous' import { useAnonymous } from '../lib/anonymous'
import { useShowModal } from './modal'
import FundError from './fund-error'
const defaultTips = [100, 1000, 10000, 100000] const defaultTips = [100, 1000, 10000, 100000]
@ -43,7 +41,6 @@ export default function ItemAct ({ onClose, itemId, act, strike }) {
const inputRef = useRef(null) const inputRef = useRef(null)
const me = useMe() const me = useMe()
const [oValue, setOValue] = useState() const [oValue, setOValue] = useState()
const showModal = useShowModal()
useEffect(() => { useEffect(() => {
inputRef.current?.focus() inputRef.current?.focus()
@ -78,23 +75,7 @@ export default function ItemAct ({ onClose, itemId, act, strike }) {
}} }}
schema={amountSchema} schema={amountSchema}
onSubmit={async ({ amount }) => { onSubmit={async ({ amount }) => {
try {
await anonAct(amount) await anonAct(amount)
} catch (error) {
if (error.toString().includes('insufficient funds')) {
showModal(onClose => {
return (
<FundError
onClose={onClose}
amount={amount}
onPayment={submitAct}
/>
)
})
return
}
throw new Error({ message: error.toString() })
}
}} }}
> >
<Input <Input