From 83df9ddd44228ac2d5c4a6aafcf365ae39260d10 Mon Sep 17 00:00:00 2001 From: Samandar Turgunboyev Date: Sun, 2 Nov 2025 17:54:48 +0500 Subject: [PATCH] bug fix --- src/App.tsx | 11 ++++------- vercel.json | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) 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": "/" }] }