mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
Fix task due date not saving correctly to a future date
Add console logging to client and server to debug and fix an issue where task due dates were not being saved correctly, defaulting to the current date instead of the selected future date. Replit-Commit-Author: Agent Replit-Commit-Session-Id: cc2d271b-82f0-4d6a-9302-a0b067ffb429 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/cc2d271b-82f0-4d6a-9302-a0b067ffb429/xi95nEa
This commit is contained in:
1 parent
c8b76c8b2e
commit
87cc2a0f88
4 files changed
+93
-2
No files matched your search
@@ -134,7 +134,12 @@ export default function TaskForm({ task, onClose }: TaskFormProps) {
|
||||
createdBy: user?.id,
|
||||
dueDate: data.dueDate || null
|
||||
};
|
||||
console.log('🚀 Creating task with data:', taskData);
|
||||
console.log('🚀 Creating task with data:', {
|
||||
...taskData,
|
||||
dueDate: taskData.dueDate,
|
||||
dueDateType: typeof taskData.dueDate,
|
||||
dueDateISO: taskData.dueDate?.toISOString?.()
|
||||
});
|
||||
return apiRequest("/api/tasks", "POST", taskData);
|
||||
},
|
||||
onSuccess: () => {
|
||||
@@ -156,7 +161,16 @@ export default function TaskForm({ task, onClose }: TaskFormProps) {
|
||||
});
|
||||
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: (data: any) => apiRequest(`/api/tasks/${task?.id}`, "PUT", data),
|
||||
mutationFn: (data: any) => {
|
||||
console.log('🔄 Updating task with data:', {
|
||||
taskId: task?.id,
|
||||
data,
|
||||
dueDate: data.dueDate,
|
||||
dueDateType: typeof data.dueDate,
|
||||
dueDateISO: data.dueDate?.toISOString?.()
|
||||
});
|
||||
return apiRequest(`/api/tasks/${task?.id}`, "PUT", data);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["/api/tasks"] });
|
||||
toast({
|
||||
@@ -176,6 +190,17 @@ export default function TaskForm({ task, onClose }: TaskFormProps) {
|
||||
});
|
||||
|
||||
const onSubmit = (data: TaskFormData) => {
|
||||
// Debug: log des données de soumission
|
||||
console.log('📝 TaskForm onSubmit:', {
|
||||
isEdit: !!task,
|
||||
taskId: task?.id,
|
||||
formData: data,
|
||||
dueDate: data.dueDate,
|
||||
dueDateType: typeof data.dueDate,
|
||||
dueDateISO: data.dueDate?.toISOString(),
|
||||
localSelectedStoreId
|
||||
});
|
||||
|
||||
// Vérifier qu'un magasin est auto-sélectionné
|
||||
if (!localSelectedStoreId) {
|
||||
toast({
|
||||
@@ -196,9 +221,11 @@ export default function TaskForm({ task, onClose }: TaskFormProps) {
|
||||
assignedTo: data.assignedTo,
|
||||
dueDate: data.dueDate || null,
|
||||
};
|
||||
console.log('🔄 Update task submitData:', submitData);
|
||||
updateMutation.mutate(submitData);
|
||||
} else {
|
||||
// Création d'une nouvelle tâche - le groupId sera ajouté dans createMutation
|
||||
console.log('➕ Create task data:', data);
|
||||
createMutation.mutate(data);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user