refactor the use of plain string order types

This commit is contained in:
2025-10-28 13:29:52 +03:00
parent 7aa686166b
commit 1abb63e8bd
16 changed files with 73 additions and 58 deletions

View File

@@ -6,10 +6,11 @@ import { useNavigate, useParams } from "react-router-dom";
import { useAppSelector } from "redux/hooks";
import styles from "../../address/address.module.css";
import useOrder from "../hooks/useOrder";
import { OrderType } from "pages/checkout/hooks/types.ts";
export default function CheckoutButton({ form }: { form: FormInstance }) {
const { t } = useTranslation();
const { orderType } = useAppSelector(selectCart)
const { orderType } = useAppSelector(selectCart);
const navigate = useNavigate();
const { handleCreateOrder } = useOrder();
const { id } = useParams();
@@ -28,7 +29,7 @@ export default function CheckoutButton({ form }: { form: FormInstance }) {
}, [handleCreateOrder, form]);
const shouldShowSplitBill = useMemo(
() => orderType === "dine-in",
() => orderType === OrderType.DineIn,
[orderType],
);