chore: On ne fait pas disparaitre les notifications en "erreur"

This commit is contained in:
N3WT DE COMPET
2025-05-31 09:21:09 +02:00
parent e74f9c98a2
commit 3a2455f918

View File

@ -33,12 +33,19 @@ export default function FlashNotification({
const [isVisible, setIsVisible] = useState(true);
useEffect(() => {
const timer = setTimeout(() => {
setIsVisible(false); // Déclenche la disparition
setTimeout(onClose, 300); // Appelle onClose après l'animation
}, displayPeriod); // Notification visible pendant 3 secondes par défaut
return () => clearTimeout(timer);
}, [onClose, displayPeriod]);
setIsVisible(true);
}, [message, type, errorCode, onClose]);
useEffect(() => {
if (type !== 'error') {
const timer = setTimeout(() => {
setIsVisible(false); // Déclenche la disparition
setTimeout(onClose, 300); // Appelle onClose après l'animation
}, displayPeriod);
return () => clearTimeout(timer);
}
// Pour les erreurs, pas de timeout : la notification reste affichée
}, [onClose, displayPeriod, type]);
if (!message || !isVisible) return null;