Add detailed logging to announcement creation for debugging

Add extensive console logging on both client and server to aid in debugging announcement creation issues, including validation checks and user role verification.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce/aVFsaJG
This commit is contained in:
michaelschal committed 2025-08-16 12:22:50 +00:00
1 parent d7aed9dc25
commit 3134732cb2
3 files changed
+244 -2

No files matched your search

+21 -1
View File
@@ -137,6 +137,22 @@ export default function AnnouncementCard() {
});
const onSubmit = (data: z.infer<typeof formSchema>) => {
console.log('🔥 [FORM] onSubmit called with data:', data);
console.log('🔥 [FORM] Form errors:', form.formState.errors);
console.log('🔥 [FORM] Form is valid:', form.formState.isValid);
console.log('🔥 [FORM] Form is submitting:', form.formState.isSubmitting);
if (!data.title || !data.content) {
console.error('🔥 [FORM] Missing required fields:', { title: data.title, content: data.content });
toast({
title: "Erreur",
description: "Le titre et le contenu sont obligatoires",
variant: "destructive",
});
return;
}
console.log('🔥 [FORM] Calling createMutation.mutate');
createMutation.mutate(data);
};
@@ -268,7 +284,11 @@ export default function AnnouncementCard() {
>
Annuler
</Button>
<Button type="submit" disabled={createMutation.isPending}>
<Button
type="submit"
disabled={createMutation.isPending}
onClick={() => console.log('🔥 [BUTTON] Submit button clicked')}
>
{createMutation.isPending ? 'Création...' : 'Créer'}
</Button>
</div>