This commit is contained in:
hamid zarghami
2024-12-31 16:45:28 +03:30
parent 882cd84846
commit a83b6a3927
2 changed files with 13 additions and 4 deletions
+12 -3
View File
@@ -21,6 +21,8 @@ export const WalletAddress: FC<Props> = ({ pending }) => {
mutationFn: sendwithdraw,
mutationKey: ["withdraw"]
})
const [price, setPrice] = useState<string>('')
const { handleSubmit, formState: { errors }, control, watch } = useForm<any>({
})
const cardDetail: any = watch("card")
@@ -39,13 +41,17 @@ export const WalletAddress: FC<Props> = ({ pending }) => {
const selectedCard: CardBank | CardBank[] | [] = user?.cardBank?.filter((cardBanks: any) => cardBanks?.IBAN === cardDetail?.id && cardBanks?.PAN === cardDetail?.name)
setSelectedCard(selectedCard?.[0])
}, [cardDetail])
const handleSendWithdraw: SubmitHandler<SendWithdraw> = async () => {
console.log(price);
await mutate({
card: {
holderName: selectedCard?.holderName,
PAN: selectedCard?.PAN,
IBAN: selectedCard?.IBAN
}
IBAN: selectedCard?.IBAN,
},
amount: +price
}, {
onSuccess: (res: any) => {
toast.success("درخواست شما با موفقیت ثبت شد")
@@ -62,13 +68,16 @@ export const WalletAddress: FC<Props> = ({ pending }) => {
<div className="flex flex-col gap-10">
<p className="text-2xl font-medium text-primary-text-color">ثبت درخواست برداشت از حساب</p>
{!pending && <Controller control={control} name="card" render={({ field }) => (
<>
<ComboBox placeholder="حساب بانکی مورد نظر خود را انتخاب کنید" data={userBanks} field={field} />
<ErrorComponent show={errors?.card} message={errors?.card?.message} />
{/* <Input placeholder="مبلغ را وارد کنید" /> */}
<Input placeholder="مبلغ را وارد کنید" value={price} onChange={(e: any) => setPrice(e.target.value)} />
</>
)} />}
{/* <input className="h-12 text-right px-4 rounded-2xl" type="tel" placeholder="مبلغ را وارد کنید" /> */}
</div>
{!pending && <p className="font-normal text-base text-primary-text-color text-justify lg:text-wrap">
برای درخواست برداشت از حساب، حساب بانکی مورد نظر خود را انتخاب کنید. پس از انتخاب حساب بانکی، مبلغ مورد نظر خود را وارد کرده و درخواست خود را ثبت کنید.
+1 -1
View File
@@ -1,7 +1,7 @@
import axios from "axios";
const axiosInstance = axios.create({
// baseURL: "http://localhost:7420/api",
// baseURL: "http://192.168.0.243:7420/api",
baseURL: "https://asan-service.com/api",
});