add order details & enhance the checkout page
This commit is contained in:
@@ -5,7 +5,7 @@ import ProText from "components/ProText";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useAppSelector } from "redux/hooks";
|
||||
import { selectCart } from "features/order/orderSlice";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
||||
import { useGetOrderDetailsQuery } from "redux/api/others";
|
||||
import BackIcon from "components/Icons/BackIcon";
|
||||
|
||||
@@ -14,6 +14,7 @@ export default function BriefMenuCard() {
|
||||
const { items } = useAppSelector(selectCart);
|
||||
const { subdomain, orderId } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { data: orderDetails } = useGetOrderDetailsQuery(
|
||||
{
|
||||
orderID: orderId || "",
|
||||
@@ -41,7 +42,11 @@ export default function BriefMenuCard() {
|
||||
padding: "16px 0",
|
||||
}}
|
||||
onClick={() => {
|
||||
navigate(`/${subdomain}/cart`);
|
||||
if (orderId && location.pathname.includes("/order/")) {
|
||||
navigate(`/${subdomain}/order/details/${orderId}`);
|
||||
} else {
|
||||
navigate(`/${subdomain}/cart`);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ProText
|
||||
|
||||
Reference in New Issue
Block a user