fix: Обработка массива в ответе n8n для CreateWebClaim
- ✅ n8n может вернуть [{success: true, ...}] вместо {success: true, ...} - ✅ Добавлена проверка Array.isArray и извлечение первого элемента - ✅ Теперь корректно обрабатывается ответ от webhook создания заявки
This commit is contained in:
@@ -54,7 +54,12 @@ const Step2EventType: React.FC<Props> = ({ formData, updateFormData, onNext, onP
|
||||
})
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
let result = await response.json();
|
||||
|
||||
// ✅ n8n может вернуть массив - берём первый элемент
|
||||
if (Array.isArray(result) && result.length > 0) {
|
||||
result = result[0];
|
||||
}
|
||||
|
||||
if (response.ok && result.success) {
|
||||
addDebugEvent?.('claim', 'success', `✅ Черновик заявки создан`, result);
|
||||
|
||||
Reference in New Issue
Block a user