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 shouldShowSidebar = !hideSidebarPaths.includes(location.pathname);
// 🔹 Avtorizatsiya yonalishlari
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");

View File

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