Migração completa para Logto - Remoção de Clerk finalizada
This commit is contained in:
@@ -23,7 +23,7 @@ export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({
|
||||
requireEdit = false,
|
||||
redirectTo = '/',
|
||||
}) => {
|
||||
const { appUser, isLoading, canEdit } = useAuth();
|
||||
const { appUser, isLoading, canEdit, isSignedIn } = useAuth();
|
||||
|
||||
// Show loading state
|
||||
if (isLoading) {
|
||||
@@ -34,6 +34,11 @@ export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({
|
||||
);
|
||||
}
|
||||
|
||||
// Check authentication
|
||||
if (!isSignedIn) {
|
||||
return <Navigate to="/login" replace />;
|
||||
}
|
||||
|
||||
// Check role-based access
|
||||
if (allowedRoles && appUser && !allowedRoles.includes(appUser.role)) {
|
||||
return <Navigate to={redirectTo} replace />;
|
||||
|
||||
Reference in New Issue
Block a user