fix: network offline tip

This commit is contained in:
Tristan Yang
2022-08-03 22:54:00 +08:00
parent eba6d1de52
commit d99a3428f8
5 changed files with 18 additions and 10 deletions
+3 -4
View File
@@ -26,7 +26,7 @@ import HomePage from "./home";
import ChatPage from "./chat";
import Loading from "../common/component/Loading";
import store, { useAppSelector } from "../app/store";
let toastId: string;
const PageRoutes = () => {
const {
ui: { online },
@@ -37,10 +37,9 @@ const PageRoutes = () => {
// 掉线检测
useEffect(() => {
let toastId = "0";
if (!online) {
toast.error("Network Offline!", { duration: Infinity });
} else {
toastId = toast.error("Network Offline!", { duration: Infinity });
} else if (toastId) {
toast.dismiss(toastId);
}
}, [online]);