chore: Änderungen commited
This commit is contained in:
@@ -353,22 +353,26 @@
|
||||
}
|
||||
|
||||
try {
|
||||
const csrfToken = "{{ csrf_token() }}"; // CSRF Token holen
|
||||
const response = await fetch('/api/mindmaps', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken // CSRF Token im Header senden
|
||||
},
|
||||
body: JSON.stringify({ name, description }),
|
||||
body: JSON.stringify({ name, description, is_private: false }), // is_private standardmäßig auf false setzen
|
||||
});
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
throw new Error(errorData.error || `HTTP error! status: ${response.status}`);
|
||||
}
|
||||
const newMindmap = await response.json();
|
||||
showNotification(`Mindmap "${newMindmap.name}" erfolgreich erstellt.`, 'success');
|
||||
showNotification(`Mindmap "${newMindmap.name}" erfolgreich erstellt. Weiterleitung...`, 'success');
|
||||
createMindmapModal.classList.add('hidden');
|
||||
createMindmapForm.reset();
|
||||
fetchUserMindmaps(); // Liste aktualisieren
|
||||
// fetchUserMindmaps(); // Liste wird auf der neuen Seite ohnehin neu geladen oder ist nicht direkt sichtbar.
|
||||
// Weiterleitung zur Bearbeitungsseite der neuen Mindmap
|
||||
window.location.href = `/edit_mindmap/${newMindmap.id}`;
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Erstellen der Mindmap:', error);
|
||||
showNotification(`Fehler beim Erstellen: ${error.message}`, 'error');
|
||||
|
||||
Reference in New Issue
Block a user