"feat: Implement CSRF documentation update in backend/app/CSRF_FIX_DOCUMENTATION.md"

This commit is contained in:
2025-05-29 11:54:07 +02:00
parent 3aa05195c0
commit 8e8da1bb07
3 changed files with 31 additions and 3 deletions

View File

@@ -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)
});