refactor the use of plain string order types
This commit is contained in:
@@ -7,6 +7,7 @@ import { useCallback, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useAppDispatch, useAppSelector } from "redux/hooks";
|
||||
import styles from "../../address/address.module.css";
|
||||
import { OrderType } from "pages/checkout/hooks/types.ts";
|
||||
|
||||
interface LocationData {
|
||||
lat: number;
|
||||
@@ -19,7 +20,7 @@ export const AddressSummary = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const { location } = useAppSelector(selectCart);
|
||||
const [isMapBottomSheetOpen, setIsMapBottomSheetOpen] = useState(false);
|
||||
const { orderType } = useAppSelector(selectCart) // Default to delivery for now
|
||||
const { orderType } = useAppSelector(selectCart); // Default to delivery for now
|
||||
|
||||
const handleLocationSave = useCallback(
|
||||
(locationString: string) => {
|
||||
@@ -46,7 +47,10 @@ export const AddressSummary = () => {
|
||||
[location],
|
||||
);
|
||||
|
||||
const shouldRender = useMemo(() => orderType === "delivery", [orderType]);
|
||||
const shouldRender = useMemo(
|
||||
() => orderType === OrderType.Delivery,
|
||||
[orderType],
|
||||
);
|
||||
|
||||
if (!shouldRender) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user