Removed console.log
This commit is contained in:
@@ -23,22 +23,19 @@ export function NotificationProvider({ children }: PropsWithChildren) {
|
|||||||
const [popupShowed, setPopupShowed] = useState(false);
|
const [popupShowed, setPopupShowed] = useState(false);
|
||||||
|
|
||||||
const notify = (newNotification: NotificationType, timeout: number) => {
|
const notify = (newNotification: NotificationType, timeout: number) => {
|
||||||
console.log("Changed notification");
|
|
||||||
setNotification(newNotification);
|
setNotification(newNotification);
|
||||||
setNotificationTimeout(timeout);
|
setNotificationTimeout(timeout);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!popupShowed && notification !== null) {
|
if (notification === null) {
|
||||||
console.log("setting timeout")
|
setPopupShowed(false);
|
||||||
|
} else if (!popupShowed && notificationTimeout !== Infinity) {
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
console.log("timeout done")
|
|
||||||
setPopupShowed(true);
|
setPopupShowed(true);
|
||||||
setNotification(null);
|
setNotification(null);
|
||||||
}, notificationTimeout);
|
}, notificationTimeout);
|
||||||
return () => clearTimeout(timeout);
|
return () => clearTimeout(timeout);
|
||||||
} else {
|
|
||||||
setPopupShowed(false);
|
|
||||||
}
|
}
|
||||||
}, [notification, notificationTimeout]);
|
}, [notification, notificationTimeout]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user