change url param name to "subdomain"
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
selectGrandTotal,
|
||||
selectHighestPricedLoyaltyItem,
|
||||
} from "features/order/orderSlice";
|
||||
import { OrderType } from "pages/checkout/hooks/types.ts";
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
@@ -12,13 +13,12 @@ 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();
|
||||
const navigate = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
const { id } = useParams();
|
||||
const { subdomain } = useParams();
|
||||
const restaurantID = localStorage.getItem("restaurantID");
|
||||
const { mobilenumber, user_uuid } = JSON.parse(
|
||||
localStorage.getItem("customer") || "{}",
|
||||
@@ -98,7 +98,7 @@ export default function useOrder() {
|
||||
// window.open(
|
||||
// `${PAYMENT_CONFIRMATION_URL}/${res.data.result.orderID}`,
|
||||
// );
|
||||
else navigate(`/${id}/order/${res.data.result.orderID}`);
|
||||
else navigate(`/${subdomain}/order/${res.data.result.orderID}`);
|
||||
dispatch(clearCart());
|
||||
localStorage.setItem("orderID", res.data.result.orderID);
|
||||
}
|
||||
@@ -106,32 +106,6 @@ export default function useOrder() {
|
||||
.catch((error: any) => {
|
||||
console.error("Create Order failed:", error);
|
||||
});
|
||||
}, [
|
||||
createOrder,
|
||||
mobilenumber,
|
||||
phone,
|
||||
giftDetails?.senderPhone,
|
||||
giftDetails?.receiverName,
|
||||
giftDetails?.receiverPhone,
|
||||
giftDetails?.message,
|
||||
giftDetails?.isSecret,
|
||||
giftDetails?.senderEmail,
|
||||
giftDetails?.senderName,
|
||||
coupon,
|
||||
specialRequest,
|
||||
tables,
|
||||
orderType,
|
||||
id,
|
||||
restaurantID,
|
||||
items,
|
||||
officeDetails?.officeNo,
|
||||
user_uuid,
|
||||
estimateTime,
|
||||
tip,
|
||||
orderPrice,
|
||||
t,
|
||||
navigate,
|
||||
dispatch,
|
||||
]);
|
||||
}, [createOrder, mobilenumber, phone, giftDetails?.senderPhone, giftDetails?.receiverName, giftDetails?.receiverPhone, giftDetails?.message, giftDetails?.isSecret, giftDetails?.senderEmail, giftDetails?.senderName, coupon, specialRequest, tables, orderType, restaurantID, items, officeDetails?.officeNo, user_uuid, estimateTime, orderPrice, useLoyaltyPoints, highestLoyaltyItem, tip, t, navigate, subdomain, dispatch]);
|
||||
return { handleCreateOrder };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user