import { useState, type FC } from 'react' import Button from '../../../components/Button' import DefaulModal from '../../../components/DefaulModal' import { usePayment } from '../hooks/useResellerData' import Input from '../../../components/Input' import { toast } from 'react-toastify' import { ErrorType } from '../../../helpers/types' type Props = { id: string, refetch: () => void, } const Payment: FC = ({ id, refetch }) => { const payment = usePayment() const [showModal, setShowModal] = useState(false) const [transactionId, setTransactionId] = useState('') const handleSubmit = () => { if (transactionId.length > 0) { payment.mutate({ id: id, transactionId: transactionId }, { onSuccess: () => { toast('با موفقت ثبت شد') setTransactionId('') refetch() }, onError: (error: ErrorType) => { toast.error(error.response?.data?.error.message[0]) } }) } else { toast.error('شماره تراکنش رو پر کنید') } } return (
) } export default Payment