diff --git a/src/App.tsx b/src/App.tsx
index e845272..de235aa 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -12,29 +12,26 @@ import { AuthProvider, useAuth } from './contexts/AuthContext';
import { ListingProvider } from './contexts/ListingContext';
import Register from './pages/Register';
-//register button route
-} />
-
// Protected route component
-const ProtectedRoute: React.FC<{
+const ProtectedRoute: React.FC<{
children: React.ReactNode;
allowedRoles?: string[];
}> = ({ children, allowedRoles }) => {
const { user, loading } = useAuth();
const location = useLocation();
-
+
if (loading) {
return
Loading...
;
}
-
+
if (!user) {
return ;
}
-
+
if (allowedRoles && !allowedRoles.includes(user.role)) {
return ;
}
-
+
return <>{children}>;
};
@@ -62,26 +59,29 @@ function App() {
} />
} />
+ {/* ADD THIS LINE - The fix for your button */}
+ } />
+
{/* Protected admin routes */}
-
- }
+ }
/>
-
+
{/* Protected agency routes */}
-
- }
+ }
/>
-
+
{/* Redirect unknown routes to home */}
} />