diff --git a/attached_assets/{86795419-9BAD-4C8E-BFF5-840132D9DCDD}_1755599740679.png b/attached_assets/{86795419-9BAD-4C8E-BFF5-840132D9DCDD}_1755599740679.png new file mode 100644 index 0000000..9316626 Binary files /dev/null and b/attached_assets/{86795419-9BAD-4C8E-BFF5-840132D9DCDD}_1755599740679.png differ diff --git a/client/src/pages/Tasks.tsx b/client/src/pages/Tasks.tsx index 3e130d9..214c7d5 100644 --- a/client/src/pages/Tasks.tsx +++ b/client/src/pages/Tasks.tsx @@ -78,20 +78,28 @@ function TaskFormInline({ task, onClose }: any) { }; const url = task ? `/api/tasks/${task.id}` : '/api/tasks'; - const method = task ? 'PATCH' : 'POST'; + const method = task ? 'PUT' : 'POST'; if (!task) { (taskData as any).groupId = 1; (taskData as any).createdBy = 'admin'; } + console.log('📤 Sending request:', { url, method, taskData }); + const response = await fetch(url, { method, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(taskData), }); - if (!response.ok) throw new Error(`Erreur ${response.status}`); + console.log('📥 Response:', { status: response.status, ok: response.ok }); + + if (!response.ok) { + const errorText = await response.text(); + console.error('❌ API Error:', { status: response.status, error: errorText }); + throw new Error(`Erreur ${response.status}: ${errorText}`); + } alert(task ? "Tâche modifiée avec succès" : "Tâche créée avec succès"); window.location.reload();