Update scheduled posts calendar to automatically display new posts

Invalidates the '/api/scheduled-posts' query cache on successful post creation to trigger a refetch and update the UI, resolving the need for manual page reloads.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/Z1TMYri
This commit is contained in:
michaelschal committed 2025-10-09 13:38:38 +00:00
1 parent 7517df10e4
commit 2e2949be27
2 files changed
+2 -5

No files matched your search

+2 -1
View File
@@ -213,7 +213,8 @@ export default function NewPost() {
const createPostMutation = useMutation({
mutationFn: (data: any) =>
apiRequest('POST', '/api/posts', data),
onSuccess: () => {
onSuccess: async () => {
await queryClient.invalidateQueries({ queryKey: ['/api/scheduled-posts'], refetchType: 'all' });
toast({
title: "Publication créée",
description: "La publication a été créée avec succès",