nest routes
This commit is contained in:
@@ -13,12 +13,13 @@ import RestaurantServices from "./RestaurantServices";
|
||||
import Ads1 from "components/Ads/Ads1";
|
||||
import { Loader } from "components/Loader/Loader";
|
||||
import { useRestaurant } from "hooks/useRestaurant";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useParams, Outlet, useLocation } from "react-router-dom";
|
||||
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||
import LocalStorageHandler from "../menu/components/LocalStorageHandler";
|
||||
|
||||
export default function RestaurantPage() {
|
||||
const param = useParams();
|
||||
const { pathname } = useLocation();
|
||||
const { isRTL } = useAppSelector((state) => state.locale);
|
||||
const { data: restaurant, isLoading } = useGetRestaurantDetailsQuery("595", {
|
||||
skip: !param.id,
|
||||
@@ -39,6 +40,8 @@ export default function RestaurantPage() {
|
||||
localStorage.setItem("restaurantID", restaurant.restautantId);
|
||||
}
|
||||
|
||||
if (param.id && !pathname.endsWith(param.id)) return <Outlet />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={styles.languageSwitch}>
|
||||
|
||||
Reference in New Issue
Block a user