Minimax correcao
This commit is contained in:
@@ -23,21 +23,7 @@ export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({
|
||||
requireEdit = false,
|
||||
redirectTo = '/',
|
||||
}) => {
|
||||
const { appUser, isLoading, canEdit, isSignedIn } = useAuth();
|
||||
|
||||
// Show loading state
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-[60vh]">
|
||||
<RefreshCw size={32} className="animate-spin text-primary" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Check authentication
|
||||
if (!isSignedIn) {
|
||||
return <Navigate to="/login" replace />;
|
||||
}
|
||||
const { appUser, canEdit } = useAuth();
|
||||
|
||||
// Check role-based access
|
||||
if (allowedRoles && appUser && !allowedRoles.includes(appUser.role)) {
|
||||
|
||||
Reference in New Issue
Block a user