fix of the json upload format
This commit is contained in:
+1
-1
@@ -11863,8 +11863,8 @@ def batch_upload_page():
|
||||
return render_template('upload_batch.html')
|
||||
|
||||
|
||||
|
||||
@app.route('/upload_csv_batch', methods=['POST'])
|
||||
@csrf.exempt
|
||||
def upload_csv_batch():
|
||||
"""
|
||||
Route for batch adding new items to the inventory via CSV.
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
padding-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -272,11 +273,15 @@ document.getElementById('batchUploadForm').addEventListener('submit', async func
|
||||
formData.append('images', img);
|
||||
});
|
||||
|
||||
// An Server senden
|
||||
try {
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||
|
||||
const response = await fetch('/upload_csv_batch', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
body: formData,
|
||||
headers: {
|
||||
'X-CSRFToken': csrfToken
|
||||
}
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
Reference in New Issue
Block a user