refactor the use of plain string order types

This commit is contained in:
2025-10-28 13:29:52 +03:00
parent 7aa686166b
commit 1abb63e8bd
16 changed files with 73 additions and 58 deletions

View File

@@ -3,7 +3,7 @@ import {
clearCart,
selectCart,
selectGrandTotal,
selectHighestPricedLoyaltyItem
selectHighestPricedLoyaltyItem,
} from "features/order/orderSlice";
import { useCallback } from "react";
import { useTranslation } from "react-i18next";
@@ -12,6 +12,7 @@ import { useCreateOrderMutation } from "redux/api/others";
import { useAppDispatch, useAppSelector } from "redux/hooks";
import { PAYMENT_CONFIRMATION_URL } from "utils/constants";
import { Customer } from "../../otp/types";
import { OrderType } from "pages/checkout/hooks/types.ts";
export default function useOrder() {
const dispatch = useAppDispatch();
@@ -72,7 +73,7 @@ export default function useOrder() {
use_loylaty: useLoyaltyPoints && highestLoyaltyItem ? 1 : 0,
useWallet: 0,
tip,
...(orderType === "gift"
...(orderType === OrderType.Gift
? {
receiverName: giftDetails?.receiverName,
receiverPhone: giftDetails?.receiverPhone,