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 hideSidebarPaths = ["/login"];
|
||||||
const shouldShowSidebar = !hideSidebarPaths.includes(location.pathname);
|
const shouldShowSidebar = !hideSidebarPaths.includes(location.pathname);
|
||||||
|
|
||||||
// 🔹 Avtorizatsiya yo‘nalishlari
|
|
||||||
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");
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
|
"rewrites": [{ "source": "/(.*)", "destination": "/" }]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user