chore: update signin button in visitor mode

This commit is contained in:
boojack
2022-07-25 21:50:25 +08:00
parent cfa4151cff
commit 58e68f8f80
9 changed files with 55 additions and 27 deletions

View File

@ -1,10 +1,21 @@
import { useEffect, useState } from "react";
import { appRouterSwitch } from "./routers";
import { locationService } from "./services";
import { useAppSelector } from "./store";
function App() {
const pathname = useAppSelector((state) => state.location.pathname);
const [isLoading, setLoading] = useState(true);
return <>{appRouterSwitch(pathname)}</>;
useEffect(() => {
locationService.updateStateWithLocation();
window.onpopstate = () => {
locationService.updateStateWithLocation();
};
setLoading(false);
}, []);
return <>{isLoading ? null : appRouterSwitch(pathname)}</>;
}
export default App;