fix: rename chat API routes to avoid Nginx /admin/chat/* redirect conflict

/admin/chat/conversations → /admin/chat-convs
/admin/chat/messages     → /admin/chat-msgs
/admin/chat/send         → /admin/chat-send

The production server was intercepting all subpaths of /admin/chat and
redirecting them back to /admin/chat, so fetch never received JSON.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-27 19:43:06 -05:00
co-authored by Claude Sonnet 4.6
parent 33869a6622
commit 4f30ed4447
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -1922,7 +1922,7 @@ let activePhone = '';
async function loadConvs() {
const list = document.getElementById('convList');
try {
const r = await fetch('/admin/chat/conversations');
const r = await fetch('/admin/chat-convs');
if (!r.ok) {
list.innerHTML = \`<div style="padding:16px;color:#e53e3e;font-size:13px">Error \${r.status} al cargar conversaciones</div>\`;
return;
@@ -1992,7 +1992,7 @@ async function loadMessages(phone) {
msgsDiv.innerHTML = '<div style="text-align:center;padding:20px;color:#a0a8b8">Cargando...</div>';
let data;
try {
const r = await fetch('/admin/chat/messages?phone=' + encodeURIComponent(phone));
const r = await fetch('/admin/chat-msgs?phone=' + encodeURIComponent(phone));
if (!r.ok) {
msgsDiv.innerHTML = \`<div style="text-align:center;padding:20px;color:#e53e3e">Error \${r.status}</div>\`;
return;
@@ -2064,7 +2064,7 @@ async function sendMsg() {
if (!text || !activePhone) return;
document.getElementById('sendBtn').disabled = true;
try {
const r = await fetch('/admin/chat/send', {
const r = await fetch('/admin/chat-send', {
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({phone:activePhone, text})