From 30ce8485261b1a3f6cadc4174faa65d9cc4feb82 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Tue, 7 Nov 2023 15:55:05 +0330 Subject: [PATCH] Fixed bug toast network --- src/core/components/NetworkComponent.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/components/NetworkComponent.jsx b/src/core/components/NetworkComponent.jsx index 8ebbb68..9610b1c 100644 --- a/src/core/components/NetworkComponent.jsx +++ b/src/core/components/NetworkComponent.jsx @@ -6,13 +6,13 @@ import WifiOffIcon from '@mui/icons-material/WifiOff'; import {useTranslations} from "next-intl"; const NetworkComponent = () => { - const toastId = useRef(null); + const networkToastId = useRef(null); const network = useNetwork() const t = useTranslations() useEffect(() => { if (network.online) { - toast.update(toastId.current, { + toast.update(networkToastId.current, { type: toast.TYPE.SUCCESS, render: t('online_message'), autoClose: 2000, @@ -22,8 +22,9 @@ const NetworkComponent = () => { }); return } - toast.dismiss() - toastId.current = toast.warn(t('offline_message'), { + networkToastId.current = toast.warn(t('offline_message'), { + containerId: 'connection', + draggable: false, autoClose: false, closeButton: false, closeOnClick: false, icon: }) }, [network.online]);