This commit is contained in:
Samandar Turgunboyev
2025-11-02 17:54:48 +05:00
parent 2438fcbda2
commit 83df9ddd44
2 changed files with 5 additions and 8 deletions

View File

@@ -64,15 +64,12 @@ const App = () => {
const hideSidebarPaths = ["/login"]; const hideSidebarPaths = ["/login"];
const shouldShowSidebar = !hideSidebarPaths.includes(location.pathname); const shouldShowSidebar = !hideSidebarPaths.includes(location.pathname);
// 🔹 Avtorizatsiya yonalishlari
useEffect(() => { useEffect(() => {
if (token && user) { if (token && user) {
if (user.role === "moderator") { if (location.pathname === "/") {
navigate("/user"); if (user.role === "moderator") navigate("/user");
} else if (user.role === "tour_admin") { else if (user.role === "tour_admin") navigate("/profile");
navigate("/profile"); else if (user.role === "buxgalter") navigate("/finance");
} else if (user.role === "buxgalter") {
navigate("/finance");
} }
} else if (!token) { } else if (!token) {
navigate("/login"); navigate("/login");

View File

@@ -1,3 +1,3 @@
{ {
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }] "rewrites": [{ "source": "/(.*)", "destination": "/" }]
} }