bug fix
This commit is contained in:
11
src/App.tsx
11
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");
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
|
||||
"rewrites": [{ "source": "/(.*)", "destination": "/" }]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user