diff --git a/projects/ops-desk/frontend/assets/agentic-ops.js b/projects/ops-desk/frontend/assets/agentic-ops.js
index 2242db1..7b69dd6 100644
--- a/projects/ops-desk/frontend/assets/agentic-ops.js
+++ b/projects/ops-desk/frontend/assets/agentic-ops.js
@@ -3,11 +3,13 @@
let state = { threadId: null, selectedAgent: 'A6' };
async function api(path, opts = {}) {
- const h = { ...(opts.headers || {}) };
- if (!(opts.body instanceof FormData)) h['Content-Type'] = 'application/json';
- const t = window.DeskAuth?.getToken?.();
- if (t) h.Authorization = `Bearer ${t}`;
- const r = await fetch(`/api/v1/agents${path}`, { ...opts, headers: h });
+ const h = authHeaders({ ...(opts.headers || {}) });
+ if (!(opts.body instanceof FormData) && !h['Content-Type']) h['Content-Type'] = 'application/json';
+ const r = await fetchWithTimeout(`/api/v1/agents${path}`, { ...opts, headers: h });
+ if (r.status === 401) {
+ logout();
+ throw new Error('sessão expirada — faça login novamente');
+ }
if (!r.ok) throw new Error(`${r.status} ${(await r.text()).slice(0, 200)}`);
return r.json();
}
diff --git a/projects/ops-desk/frontend/index.html b/projects/ops-desk/frontend/index.html
index 7427ec0..8f3b44d 100644
--- a/projects/ops-desk/frontend/index.html
+++ b/projects/ops-desk/frontend/index.html
@@ -443,7 +443,7 @@
-
+