Actualizar presupuestos.html

This commit is contained in:
2026-03-29 21:44:58 +00:00
parent fe5a6aa352
commit 0107b4618c

View File

@@ -778,7 +778,7 @@
const guild_id = document.getElementById('apptGuild').value;
const date = document.getElementById('apptDate').value;
const time = document.getElementById('apptTime').value;
const duration = document.getElementById('apptDuration').value; // <-- NUEVO
const duration = document.getElementById('apptDuration').value;
if (!guild_id || !date || !time) return showToast("⚠️ Gremio, Fecha y Hora son obligatorios.");
@@ -786,13 +786,22 @@
btn.disabled = true;
btn.innerHTML = '<i data-lucide="loader-2" class="w-5 h-5 animate-spin"></i> Procesando...';
// 🛑 FIX PARA EL ERROR 500: Extraemos tu ID real de usuario leyendo el token
let myId = null;
try {
const tokenBase64 = localStorage.getItem("token").split('.')[1];
myId = JSON.parse(atob(tokenBase64)).sub;
} catch(e) {
console.error("No se pudo leer el ID del token");
}
const payload = {
guild_id: guild_id,
date: date,
time: time,
duration_minutes: duration, // <-- NUEVO
duration_minutes: duration,
use_automation: false,
assigned_to: 'self'
assigned_to: myId // <--- ¡AHORA ENVÍA TU NÚMERO DE ID CORRECTO!
};
try {