feat: upload PDF file on save via multipart FormData

Switch save endpoint from JSON to multipart upload so the PDF file is
sent alongside extracted data and tags.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 05:34:34 +01:00
parent a119514319
commit d8b2278491

View File

@@ -250,17 +250,17 @@ async function handleTaggingSave(depensesTags, shouldOverwrite) {
saveMessage.value = null
try {
const response = await fetch('/api/save', {
const formData = new FormData()
formData.append('pdf_file', pdfFile.value)
formData.append('data', JSON.stringify(extractedData.value.data))
if (depensesTags && depensesTags.length > 0) {
formData.append('depenses_tags', JSON.stringify(depensesTags))
}
formData.append('overwrite', shouldOverwrite ? 'true' : 'false')
const response = await fetch('/api/save-with-pdf', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
source_file: extractedData.value.source_file,
data: extractedData.value.data,
depenses_tags: depensesTags,
overwrite: shouldOverwrite || false
})
body: formData
})
const result = await response.json()