From 144cfa3f3ac62c8d122540c7580b46c2efa3906c Mon Sep 17 00:00:00 2001 From: Mohammed Al-yaseen Date: Wed, 29 Oct 2025 15:07:25 +0300 Subject: [PATCH] fix take "orderType" from url --- src/pages/restaurant/page.tsx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/pages/restaurant/page.tsx b/src/pages/restaurant/page.tsx index 0243b2f..abf8cd9 100644 --- a/src/pages/restaurant/page.tsx +++ b/src/pages/restaurant/page.tsx @@ -27,11 +27,13 @@ import { CART_STORAGE_KEYS, } from "features/order/orderSlice.ts"; import { OrderType } from "pages/checkout/hooks/types.ts"; +import { useTranslation } from "react-i18next"; const storedOrderType = localStorage.getItem(CART_STORAGE_KEYS.ORDER_TYPE); export default function RestaurantPage() { const dispatch = useAppDispatch(); + const { t } = useTranslation(); const param = useParams(); const [searchParams] = useSearchParams(); const { pathname } = useLocation(); @@ -48,21 +50,13 @@ export default function RestaurantPage() { const urlOrderType = searchParams.get("orderType"); if (urlOrderType && urlOrderType !== orderType) dispatch(updateOrderType(urlOrderType as OrderType)); - else if ( - storedOrderType && - storedOrderType !== "" && - storedOrderType !== orderType - ) + else if (storedOrderType && !orderType) dispatch(updateOrderType(storedOrderType as OrderType)); }, [searchParams, orderType]); - if (isLoading) { - return ; - } + if (isLoading) return ; - if (!restaurant) { - return
Restaurant not found
; - } + if (!restaurant) return
{t("Restaurant not found")}
; if (restaurant) { localStorage.setItem("restaurantID", restaurant.restautantId);