diff --git a/src/App.tsx b/src/App.tsx index 505de9a..633a7d9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -64,15 +64,12 @@ const App = () => { const hideSidebarPaths = ["/login"]; const shouldShowSidebar = !hideSidebarPaths.includes(location.pathname); - // 🔹 Avtorizatsiya yo‘nalishlari useEffect(() => { if (token && user) { - if (user.role === "moderator") { - navigate("/user"); - } else if (user.role === "tour_admin") { - navigate("/profile"); - } else if (user.role === "buxgalter") { - navigate("/finance"); + if (location.pathname === "/") { + if (user.role === "moderator") navigate("/user"); + else if (user.role === "tour_admin") navigate("/profile"); + else if (user.role === "buxgalter") navigate("/finance"); } } else if (!token) { navigate("/login"); diff --git a/vercel.json b/vercel.json index 0f32683..3a48e56 100644 --- a/vercel.json +++ b/vercel.json @@ -1,3 +1,3 @@ { - "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }] + "rewrites": [{ "source": "/(.*)", "destination": "/" }] }