fix of the json upload format
This commit is contained in:
@@ -165,12 +165,22 @@
|
||||
|
||||
const formData = new FormData(form);
|
||||
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
|
||||
|
||||
const fetchOptions = {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
credentials: 'include'
|
||||
};
|
||||
|
||||
if (csrfToken) {
|
||||
fetchOptions.headers = {
|
||||
'X-CSRFToken': csrfToken
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('/upload_csv_batch', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
credentials: 'include'
|
||||
});
|
||||
const response = await fetch('/upload_csv_batch', fetchOptions);
|
||||
|
||||
// Antwort einmalig als Text auslesen, um sowohl JSON als auch HTML-Fehler abzufangen
|
||||
const responseText = await response.text();
|
||||
|
||||
Reference in New Issue
Block a user