diff --git a/frontend/src/components/GuestsList.jsx b/frontend/src/components/GuestsList.jsx index 6f0ae16..d37958e 100644 --- a/frontend/src/components/GuestsList.jsx +++ b/frontend/src/components/GuestsList.jsx @@ -9,6 +9,7 @@ export default function GuestsList() { const [filterDate, setFilterDate] = useState('all') const [search, setSearch] = useState('') const [myOnly, setMyOnly] = useState(false) + const [toast, setToast] = useState(null) const load = () => { authFetch('/api/guests').then((r) => (r.ok ? r.json() : [])).then(setGuests) @@ -25,11 +26,13 @@ export default function GuestsList() { const handleSendInvitation = async (id) => { const r = await authFetch(`/api/guests/${id}/send-invitation`, { method: 'POST' }) if (r.ok) { - alert('Email envoyé avec succès !') + setToast("L'invitation a bien été renvoyée" ) + setTimeout(() => setToast(null), 3000) load() } else { const err = await r.json() - alert(err.error || "Erreur lors de l'envoi") + setToast(err.error || "Erreur lors de l'envoi") + setTimeout(() => setToast(null), 3000) } } @@ -175,6 +178,11 @@ export default function GuestsList() { ))} {sortedDates.length === 0 &&

{myOnly ? 'Aucun invité de votre part' : 'Aucun invite pour cette periode'}

} + {toast && ( +
+ {toast} +
+ )} ) } \ No newline at end of file