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);