Improve task creation logging and group assignment clarity

Add detailed logging for task creation, including selected group ID in TasksSimplified.tsx and Tasks.tsx, and ensure correct groupId is sent in the API request.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: f2b9c241-9fdd-4abd-9041-720afc8b27d6
Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
michaelschal committed 2025-09-02 09:32:38 +00:00
1 parent 54aa499edd
commit db66792e8b
3 files changed
+18 -2

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

+7 -1
View File
@@ -87,7 +87,13 @@ function TaskFormInline({ task, onClose, selectedStoreId, user }: any) {
(taskData as any).createdBy = user?.username || 'admin';
}
console.log('📤 Sending request:', { url, method, taskData });
console.log('📤 Tasks.tsx - Sending request:', {
url,
method,
taskData,
selectedStoreId,
finalGroupId: taskData.groupId
});
const response = await fetch(url, {
method,
+11 -1
View File
@@ -80,11 +80,20 @@ export default function TasksSimplified() {
// Création d'une tâche
const handleCreateTask = async (taskData: any) => {
try {
await apiRequest('/api/tasks', 'POST', {
const finalData = {
...taskData,
groupId: selectedStoreId ? parseInt(selectedStoreId) : stores[0]?.id
};
console.log('🔍 TasksSimplified - Creating task with data:', {
selectedStoreId,
storesLength: stores.length,
finalGroupId: finalData.groupId,
taskData: finalData
});
await apiRequest('/api/tasks', 'POST', finalData);
queryClient.invalidateQueries({ queryKey: ["/api/tasks"] });
setShowCreateModal(false);
toast({
@@ -92,6 +101,7 @@ export default function TasksSimplified() {
description: "Tâche créée avec succès",
});
} catch (error) {
console.error('❌ TasksSimplified - Error creating task:', error);
toast({
title: "Erreur",
description: "Impossible de créer la tâche",