From e9d4a18d3cc74e312c80aaf6c844bbd89cd1b78a Mon Sep 17 00:00:00 2001 From: NguyenND Date: Mon, 1 Jun 2026 13:06:30 -0400 Subject: [PATCH] 06/01 Fix PDF statement import issue 2 --- app/templates/bank_import/index.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/templates/bank_import/index.html b/app/templates/bank_import/index.html index e7cc854..1b4d687 100644 --- a/app/templates/bank_import/index.html +++ b/app/templates/bank_import/index.html @@ -314,8 +314,17 @@ fd.append('file', selectedFile); if (colMap) fd.append('col_map', JSON.stringify(colMap)); - fetch('{{ url_for("bank_import.parse") }}', { method: 'POST', body: fd }) - .then(r => r.json()) + fetch('{{ url_for("bank_import.parse") }}', { + method: 'POST', + headers: { 'X-CSRFToken': CSRF }, + body: fd, + }) + .then(r => { + if (!r.ok && !r.headers.get('content-type')?.includes('application/json')) { + throw new Error(`Server error ${r.status} — check server logs for details.`); + } + return r.json(); + }) .then(data => { setParseLoading(false); if (data.error) {