mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 15:33:22 +00:00
chore: On ne fait pas disparaitre les notifications en "erreur"
This commit is contained in:
@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user