diff --git a/client/src/components/AnnouncementCard.tsx b/client/src/components/AnnouncementCard.tsx index f0ba692..7716baf 100644 --- a/client/src/components/AnnouncementCard.tsx +++ b/client/src/components/AnnouncementCard.tsx @@ -45,7 +45,7 @@ export default function AnnouncementCard() { }); // Fetch announcements - const { data: announcements = [] } = useQuery({ + const { data: announcements = [], isLoading } = useQuery({ queryKey: ['/api/announcements', selectedStoreId], queryFn: async () => { const params = new URLSearchParams(); @@ -63,6 +63,7 @@ export default function AnnouncementCard() { return response.json(); }, + enabled: !!user, }); // Fetch groups for admin @@ -182,161 +183,181 @@ export default function AnnouncementCard() { } }; + if (isLoading) { + return ( + + + Informations + + + +
+
+
+
+
+ ); + } + return ( - -
- - Informations -
- {user?.role === 'admin' && ( - - - - - - - Nouvelle information - -
- - ( - - Titre - - - - - - )} - /> - ( - - Contenu - -