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