take "orderType" from url

This commit is contained in:
2025-10-28 20:29:16 +03:00
parent 85ec18f6bb
commit ad9c9ce516
4 changed files with 41 additions and 17 deletions

View File

@@ -9,12 +9,12 @@ import { useScrollHandler } from "contexts/ScrollHandlerContext";
import useBreakPoint from "hooks/useBreakPoint";
import { useRestaurant } from "hooks/useRestaurant";
import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom";
import { useParams, useSearchParams } from "react-router-dom";
import {
useGetMenuQuery,
useGetRestaurantDetailsQuery,
} from "redux/api/others";
import { useAppSelector, useAppDispatch } from "redux/hooks";
import { useAppSelector } from "redux/hooks";
import { default_image } from "utils/constants";
import BackButton from "./components/BackButton";
import { CartButton } from "./components/CartButton/CartButton";
@@ -28,11 +28,10 @@ import SearchButton from "./components/SearchButton";
import styles from "./menu.module.css";
import { enumToSelectOptions } from "utils/helpers/helperFunctions.ts";
import { OrderType } from "pages/checkout/hooks/types.ts";
import { updateOrderType } from "features/order/orderSlice.ts";
function MenuPage() {
const { id } = useParams();
const dispatch = useAppDispatch();
const [_, setSearchParams] = useSearchParams();
const { isRTL } = useAppSelector((state) => state.locale);
const { orderType } = useAppSelector((state) => state.order);
const { t } = useTranslation();
@@ -106,7 +105,7 @@ function MenuPage() {
<Select
value={orderType}
onChange={(value) => {
dispatch(updateOrderType(value));
setSearchParams({ orderType: value });
}}
options={orderTypeOptions}
variant="borderless"