update logic
This commit is contained in:
@@ -2,9 +2,9 @@ import { Button } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ProBottomSheet } from "../ProBottomSheet/ProBottomSheet";
|
||||
import NextIcon from "components/Icons/NextIcon";
|
||||
import { useAppSelector, useAppDispatch } from "redux/hooks";
|
||||
import { updateOrderType } from "features/order/orderSlice";
|
||||
import { useAppSelector } from "redux/hooks";
|
||||
import { OrderType } from "pages/checkout/hooks/types";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
|
||||
interface OrderTypesBottomSheetBottomSheetProps {
|
||||
isOpen: boolean;
|
||||
@@ -16,11 +16,10 @@ export function OrderTypesBottomSheet({
|
||||
onClose,
|
||||
}: OrderTypesBottomSheetBottomSheetProps) {
|
||||
const { t } = useTranslation();
|
||||
const dispatch = useAppDispatch();
|
||||
const { restaurant, orderType, hiddenServices } = useAppSelector(
|
||||
(state) => state.order,
|
||||
);
|
||||
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const buttonStyle = {
|
||||
height: 48,
|
||||
width: "100%",
|
||||
@@ -33,7 +32,8 @@ export function OrderTypesBottomSheet({
|
||||
const calculatedHeight = 620 - hiddenServices * 64;
|
||||
|
||||
const handleOrderTypeSelect = (selectedOrderType: OrderType) => {
|
||||
dispatch(updateOrderType(selectedOrderType));
|
||||
searchParams.set("orderType", selectedOrderType);
|
||||
setSearchParams(searchParams);
|
||||
onClose();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user