From f1f27f1faa780185e60ec6163b19bb9686fec623 Mon Sep 17 00:00:00 2001 From: zojgame Date: Wed, 29 May 2024 11:11:47 +0500 Subject: [PATCH] routing --- src/components/Layout.tsx | 6 ++++++ src/main.tsx | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 29019b5..74a1411 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -2,10 +2,16 @@ import { FullScreen, useFullScreenHandle } from "react-full-screen"; import { useEffect } from "react"; import { Outlet } from "react-router-dom"; import useStore from "../store/store"; +import { useParams } from "react-router-dom"; const Layout = () => { const { loader, setOnFullscreen, modal, hintModal } = useStore(); const onFullscreenHandle = useFullScreenHandle(); + const { lang } = useParams(); + + useEffect(() => { + console.log("lang", lang); + }, []); useEffect(() => { setOnFullscreen(onFullscreenHandle); diff --git a/src/main.tsx b/src/main.tsx index a4aeb42..50a4c5d 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -7,15 +7,15 @@ import Layout from "./components/Layout"; const router = createBrowserRouter([ { - path: "/", + path: "/:lang/", element: , children: [ { - path: "ar/:villaTitle", + path: "villa/:villaTitle", element: , }, { - path: "ar/", + index: true, element: , }, ],