Actualizar servicios.html
This commit is contained in:
@@ -498,7 +498,7 @@
|
||||
finally { btn.innerHTML = originalContent; btn.disabled = false; }
|
||||
}
|
||||
|
||||
async function sendToAutomate() {
|
||||
async function sendToAutomate() {
|
||||
const id = document.getElementById('detId').value;
|
||||
const guild_id = document.getElementById('reGremio').value;
|
||||
const cp = document.getElementById('detCp').value;
|
||||
@@ -508,11 +508,16 @@
|
||||
const btn = document.getElementById('btnAuto');
|
||||
btn.innerHTML = '<i data-lucide="loader-2" class="w-5 h-5 animate-spin mx-auto"></i>';
|
||||
|
||||
// Leemos si el usuario tiene activado el retraso (es true por defecto)
|
||||
const savedSetting = localStorage.getItem('wa_delay_enabled');
|
||||
const useDelay = savedSetting === null ? true : savedSetting === 'true';
|
||||
|
||||
try {
|
||||
const res = await fetch(`${API_URL}/providers/automate/${id}`, {
|
||||
method: 'POST',
|
||||
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${localStorage.getItem("token")}` },
|
||||
body: JSON.stringify({ guild_id, cp })
|
||||
// Añadimos useDelay al payload que va al servidor
|
||||
body: JSON.stringify({ guild_id, cp, useDelay })
|
||||
});
|
||||
const data = await res.json();
|
||||
if(data.ok) { closeDetailModal(); showToast("Enviado a la rueda de WhatsApp"); refreshPanel(); }
|
||||
|
||||
Reference in New Issue
Block a user