history orders

This commit is contained in:
hamid zarghami
2025-12-06 11:47:50 +03:30
parent ca6ca93311
commit 991ffeda8f
6 changed files with 264 additions and 119 deletions
@@ -8,6 +8,7 @@ import { useCheckoutStore } from '../../store/Store';
import { toast } from '@/components/Toast';
import { useCreateOrder } from '../../hooks/useOrderData';
import { extractErrorMessage } from '@/lib/func';
import { useParams } from 'next/navigation';
type SummarySectionProps = {
cartModal: boolean;
@@ -19,6 +20,8 @@ export const SummarySection = ({ cartModal, onToggleCartModal }: SummarySectionP
const { t } = useTranslation('parallels', { keyPrefix: 'OrderDetail' });
const { isSelectedAddress, isSelectedShipment, isSelectedPayment } = useCheckoutStore();
const { mutate: createOrder } = useCreateOrder();
const params = useParams();
const name = params.name as string;
const handleSubmit = () => {
if (!isSelectedAddress) {
@@ -40,6 +43,7 @@ export const SummarySection = ({ cartModal, onToggleCartModal }: SummarySectionP
window.location.href = data?.data?.paymentUrl;
toast('در حال ریدایرکت به صفحه پرداخت...', 'success');
} else {
window.location.href = `/${name}/verify?orderId=${data?.data?.order?.id}`;
toast('سفارش با موفقیت ثبت شد', 'success');
}
},