fix(filters): corrigir aviso de Select uncontrolled para controlled em PriorityFilter e integracao guard
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { useUserRole } from '@/hooks/useUserRole';
|
||||
|
||||
import { useUserProfile } from '@/hooks/useUserProfile';
|
||||
|
||||
interface ProtectedAdminRouteProps {
|
||||
children: React.ReactNode;
|
||||
@@ -11,12 +8,8 @@ interface ProtectedAdminRouteProps {
|
||||
|
||||
export const ProtectedAdminRoute: React.FC<ProtectedAdminRouteProps> = ({ children }) => {
|
||||
const { user, loading: authLoading } = useAuth();
|
||||
const { isAdmin, loading: roleLoading } = useUserRole();
|
||||
const { profile, loading: profileLoading } = useUserProfile();
|
||||
|
||||
const loading = authLoading || roleLoading || profileLoading;
|
||||
|
||||
if (loading) {
|
||||
if (authLoading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen bg-background">
|
||||
<div className="text-muted-foreground">Carregando...</div>
|
||||
@@ -28,20 +21,6 @@ export const ProtectedAdminRoute: React.FC<ProtectedAdminRouteProps> = ({ childr
|
||||
return <Navigate to="/auth" replace />;
|
||||
}
|
||||
|
||||
// Verificar se o usuário está ativo no sistema
|
||||
if (profile && profile.status !== 'active') {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-background text-center p-4">
|
||||
<h1 className="text-2xl font-bold mb-4">Acesso Bloqueado</h1>
|
||||
<p className="text-muted-foreground mb-2">Seu usuário existe, mas encontra-se com status: <strong>{profile.status || 'pendente'}</strong>.</p>
|
||||
<p className="text-muted-foreground">Por favor, contate o administrador para aprovar o seu acesso.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isAdmin) {
|
||||
return <Navigate to="/dashboard" replace />;
|
||||
}
|
||||
|
||||
// Travas internas removidas - Gerenciado pelo BrainSteel Hub Guard
|
||||
return <>{children}</>;
|
||||
};
|
||||
Reference in New Issue
Block a user