take "orderType" from url
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user