Skip to content

Commit

Permalink
fix(flat-web): remove misleading error alert (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Jun 10, 2021
1 parent 6e73c70 commit 70ef156
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions web/flat-web/src/pages/HomePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./style.less";

import React, { useContext, useEffect } from "react";
import React, { useContext, useEffect, useState } from "react";
import { observer } from "mobx-react-lite";
import { MainRoomMenu } from "./MainRoomMenu";
import { MainRoomListPanel } from "./MainRoomListPanel";
Expand All @@ -14,6 +14,7 @@ export const HomePage = observer(function HomePage() {
const pushHistory = usePushHistory();
const globalStore = useContext(GlobalStoreContext);
const pageStore = useContext(PageStoreContext);
const [loading, setLoading] = useState(true);

(window as any).pageStore = pageStore;
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand All @@ -36,17 +37,15 @@ export const HomePage = observer(function HomePage() {
}
}

// if (!isUnMount) {
// updateLoginStatus(LoginStatusType.Success);
// }

return nextPage;
}

void Promise.all([checkLogin()]).then(([nextPage]) => {
void checkLogin().then(nextPage => {
if (!isUnMount) {
if (nextPage !== RouteNameType.HomePage) {
pushHistory(nextPage);
} else {
setLoading(false);
}
}
});
Expand All @@ -58,6 +57,10 @@ export const HomePage = observer(function HomePage() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

if (loading) {
return null;
}

return (
<div className="homepage-layout-horizontal-container">
<MainRoomMenu />
Expand Down

0 comments on commit 70ef156

Please sign in to comment.