"feat: Implement CSRF documentation update in backend/app/CSRF_FIX_DOCUMENTATION.md"
This commit is contained in:
@@ -435,11 +435,22 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
printer_id: formData.get('printer_id') ? parseInt(formData.get('printer_id')) : null
|
||||
};
|
||||
|
||||
// CSRF-Token aus Meta-Tag auslesen
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content;
|
||||
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
};
|
||||
|
||||
// CSRF-Token hinzufügen, wenn vorhanden
|
||||
if (csrfToken) {
|
||||
headers['X-CSRFToken'] = csrfToken;
|
||||
}
|
||||
|
||||
const response = await fetch('/api/guest/requests', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
headers: headers,
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user