Commit 71c3d8d1 by Arjun Jhukal

updated the routing after payment successfully

parent c1ed8aee
...@@ -5,6 +5,7 @@ import { useDepositMutation } from '@/services/transaction'; ...@@ -5,6 +5,7 @@ import { useDepositMutation } from '@/services/transaction';
import { showToast, ToastVariant } from '@/slice/toastSlice'; import { showToast, ToastVariant } from '@/slice/toastSlice';
import { DepositProps } from '@/types/transaction'; import { DepositProps } from '@/types/transaction';
import { Button, InputLabel, OutlinedInput } from '@mui/material'; import { Button, InputLabel, OutlinedInput } from '@mui/material';
import { useRouter } from 'next/navigation';
import Script from 'next/script'; import Script from 'next/script';
import { PaymentModeProps } from '.'; import { PaymentModeProps } from '.';
...@@ -21,7 +22,7 @@ declare global { ...@@ -21,7 +22,7 @@ declare global {
export default function PaymentForm({ id, amount, type }: DepositProps & { type: PaymentModeProps }) { export default function PaymentForm({ id, amount, type }: DepositProps & { type: PaymentModeProps }) {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const router = useRouter();
const user = useAppSelector((state) => state.auth.user); const user = useAppSelector((state) => state.auth.user);
const [payViaFortPay, { isLoading }] = useDepositMutation(); const [payViaFortPay, { isLoading }] = useDepositMutation();
...@@ -36,7 +37,8 @@ export default function PaymentForm({ id, amount, type }: DepositProps & { type: ...@@ -36,7 +37,8 @@ export default function PaymentForm({ id, amount, type }: DepositProps & { type:
amount: amount, amount: amount,
type: type as PaymentModeProps, type: type as PaymentModeProps,
payment_token: response.token payment_token: response.token
}).unwrap() }).unwrap();
router.push(`/buy-coins/${id}/success`)
} }
catch (e: any) { catch (e: any) {
dispatch(showToast({ dispatch(showToast({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment