change url param name to "subdomain"
This commit is contained in:
@@ -39,7 +39,7 @@ export default function RestaurantServices({
|
||||
}: RestaurantServicesProps) {
|
||||
const { t } = useTranslation();
|
||||
const { isRTL } = useAppSelector((state) => state.locale);
|
||||
const { id } = useParams();
|
||||
const { subdomain } = useParams();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const services = [
|
||||
@@ -54,7 +54,7 @@ export default function RestaurantServices({
|
||||
/>
|
||||
),
|
||||
color: "bg-blue-50 text-blue-600",
|
||||
href: `/${id}/menu?orderType=${OrderType.DineIn}`,
|
||||
href: `/${subdomain}/menu?orderType=${OrderType.DineIn}`,
|
||||
},
|
||||
]) ||
|
||||
[]),
|
||||
@@ -69,7 +69,7 @@ export default function RestaurantServices({
|
||||
/>
|
||||
),
|
||||
color: "bg-green-50 text-green-600",
|
||||
href: `/${id}/menu?orderType=${OrderType.Pickup}`,
|
||||
href: `/${subdomain}/menu?orderType=${OrderType.Pickup}`,
|
||||
},
|
||||
]) ||
|
||||
[]),
|
||||
@@ -84,7 +84,7 @@ export default function RestaurantServices({
|
||||
/>
|
||||
),
|
||||
color: "bg-pink-50 text-pink-600",
|
||||
href: `/${id}/menu?orderType=${OrderType.Gift}`,
|
||||
href: `/${subdomain}/menu?orderType=${OrderType.Gift}`,
|
||||
},
|
||||
]) ||
|
||||
[]),
|
||||
@@ -97,7 +97,7 @@ export default function RestaurantServices({
|
||||
<ToRoomIcon className={styles.serviceIcon + " " + styles.roomIcon} />
|
||||
),
|
||||
color: "bg-purple-50 text-purple-600",
|
||||
href: `/${id}/menu?orderType=${OrderType.ToRoom}`,
|
||||
href: `/${subdomain}/menu?orderType=${OrderType.ToRoom}`,
|
||||
},
|
||||
]) ||
|
||||
[]),
|
||||
@@ -112,7 +112,7 @@ export default function RestaurantServices({
|
||||
/>
|
||||
),
|
||||
color: "bg-orange-50 text-orange-600",
|
||||
href: `/${id}/menu?orderType=${OrderType.ToOffice}`,
|
||||
href: `/${subdomain}/menu?orderType=${OrderType.ToOffice}`,
|
||||
},
|
||||
]) ||
|
||||
[]),
|
||||
@@ -127,7 +127,7 @@ export default function RestaurantServices({
|
||||
/>
|
||||
),
|
||||
color: "bg-indigo-50 text-indigo-600",
|
||||
href: `/${id}/menu?orderType=${OrderType.Booking}`,
|
||||
href: `/${subdomain}/menu?orderType=${OrderType.Booking}`,
|
||||
},
|
||||
]) ||
|
||||
[]),
|
||||
@@ -142,7 +142,7 @@ export default function RestaurantServices({
|
||||
/>
|
||||
),
|
||||
color: "bg-indigo-50 text-indigo-600",
|
||||
href: `/${id}/address`,
|
||||
href: `/${subdomain}/address`,
|
||||
},
|
||||
]) ||
|
||||
[]),
|
||||
@@ -157,7 +157,7 @@ export default function RestaurantServices({
|
||||
/>
|
||||
),
|
||||
color: "bg-indigo-50 text-indigo-600",
|
||||
href: `/${id}/menu?orderType=${OrderType.ScheduledOrder}`,
|
||||
href: `/${subdomain}/menu?orderType=${OrderType.ScheduledOrder}`,
|
||||
},
|
||||
]) ||
|
||||
[]),
|
||||
|
||||
@@ -5,32 +5,32 @@ import XIcon from "components/Icons/social/XIcon";
|
||||
import { LanguageSwitch } from "components/LanguageSwitch/LanguageSwitch";
|
||||
import ProText from "components/ProText";
|
||||
import ProTitle from "components/ProTitle";
|
||||
import { useAppSelector, useAppDispatch } from "redux/hooks";
|
||||
import { useAppDispatch, useAppSelector } from "redux/hooks";
|
||||
import styles from "./restaurant.module.css";
|
||||
import RestaurantServices from "./RestaurantServices";
|
||||
|
||||
// Import the Client Component for localStorage handling
|
||||
import Ads1 from "components/Ads/Ads1";
|
||||
import { OrderDetailsBottomSheet } from "components/CustomBottomSheet/OrderDetailsBottomSheet";
|
||||
import { Loader } from "components/Loader/Loader";
|
||||
import { useRestaurant } from "hooks/useRestaurant";
|
||||
import {
|
||||
useParams,
|
||||
CART_STORAGE_KEYS,
|
||||
updateOrderType,
|
||||
} from "features/order/orderSlice.ts";
|
||||
import useBreakPoint from "hooks/useBreakPoint";
|
||||
import { useRestaurant } from "hooks/useRestaurant";
|
||||
import useSwipeUp from "hooks/useSwipeUp";
|
||||
import { OrderType } from "pages/checkout/hooks/types.ts";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
Outlet,
|
||||
useLocation,
|
||||
useParams,
|
||||
useSearchParams,
|
||||
} from "react-router-dom";
|
||||
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||
import LocalStorageHandler from "../menu/components/LocalStorageHandler";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
updateOrderType,
|
||||
CART_STORAGE_KEYS,
|
||||
} from "features/order/orderSlice.ts";
|
||||
import { OrderType } from "pages/checkout/hooks/types.ts";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { OrderDetailsBottomSheet } from "components/CustomBottomSheet/OrderDetailsBottomSheet";
|
||||
import useBreakPoint from "hooks/useBreakPoint.ts";
|
||||
import useSwipeUp from "hooks/useSwipeUp.ts";
|
||||
|
||||
const storedOrderType = localStorage.getItem(CART_STORAGE_KEYS.ORDER_TYPE);
|
||||
|
||||
@@ -45,8 +45,8 @@ export default function RestaurantPage() {
|
||||
(state) => state.order,
|
||||
);
|
||||
const { isRTL } = useAppSelector((state) => state.locale);
|
||||
const { data: restaurant, isLoading } = useGetRestaurantDetailsQuery("595", {
|
||||
skip: !param.id,
|
||||
const { data: restaurant, isLoading } = useGetRestaurantDetailsQuery(param.subdomain, {
|
||||
skip: !param.subdomain,
|
||||
});
|
||||
const [isOrderDetailsOpen, setIsOrderDetailsOpen] = useState(false);
|
||||
|
||||
@@ -64,7 +64,7 @@ export default function RestaurantPage() {
|
||||
dispatch(updateOrderType(urlOrderType as OrderType));
|
||||
else if (storedOrderType && !orderType)
|
||||
dispatch(updateOrderType(storedOrderType as OrderType));
|
||||
}, [searchParams, orderType]);
|
||||
}, [searchParams, orderType, dispatch]);
|
||||
|
||||
if (isLoading) return <Loader />;
|
||||
|
||||
@@ -74,7 +74,7 @@ export default function RestaurantPage() {
|
||||
localStorage.setItem("restaurantID", restaurant.restautantId);
|
||||
}
|
||||
|
||||
if (param.id && !pathname.endsWith(param.id)) return <Outlet />;
|
||||
if (param.subdomain && !pathname.endsWith(param.subdomain)) return <Outlet />;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user