Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot] 2026-04-23 21:46:57 +00:00
parent cb18639085
commit 04b34f9217

View file

@ -80,7 +80,7 @@ function AgentDetailPage() {
const { data: isAdmin, isLoading: roleLoading } = useQuery({ const { data: isAdmin, isLoading: roleLoading } = useQuery({
queryKey: ["is-admin", user?.id], queryKey: ["is-admin", user?.id],
enabled: !!user, enabled: !authLoading && !!user,
queryFn: async () => { queryFn: async () => {
const { data, error } = await supabase.rpc("has_role", { const { data, error } = await supabase.rpc("has_role", {
_user_id: user!.id, _user_id: user!.id,
@ -93,7 +93,7 @@ function AgentDetailPage() {
const { data: agent, isLoading: agentLoading, error: agentError } = useQuery({ const { data: agent, isLoading: agentLoading, error: agentError } = useQuery({
queryKey: ["agent-detail", id], queryKey: ["agent-detail", id],
enabled: !!isAdmin, enabled: !authLoading && !!user && isAdmin === true,
refetchInterval: 10_000, refetchInterval: 10_000,
queryFn: async () => { queryFn: async () => {
console.log("[admin.agente] fetching agent detail", { id }); console.log("[admin.agente] fetching agent detail", { id });