Depuró envío de reserva
Añadí logging detallado en el envío del formulario para diagnosticar errores de la webhook. Se registra URL destino, payload, y respuesta HTTP, y se capturan errores con mensajes para facilitar la resolución. X-Lovable-Edit-ID: edt-01264426-ef82-4a95-9a64-17211d021a3d Co-authored-by: Ichitux <17677572+Ichitux@users.noreply.github.com>
This commit is contained in:
@@ -55,14 +55,20 @@ const BookingSection = () => {
|
||||
|
||||
setStatus("loading");
|
||||
try {
|
||||
console.log("[Booking] Sending to:", WEBHOOK_URL);
|
||||
console.log("[Booking] Payload:", JSON.stringify(result.data));
|
||||
const res = await fetch(WEBHOOK_URL, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(result.data),
|
||||
});
|
||||
if (!res.ok) throw new Error("Error en la solicitud");
|
||||
console.log("[Booking] Response status:", res.status, res.statusText);
|
||||
const text = await res.text();
|
||||
console.log("[Booking] Response body:", text);
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}: ${text}`);
|
||||
setStatus("success");
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.error("[Booking] Error:", err);
|
||||
setStatus("error");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user