mirror of https://github.com/usememos/memos
chore: update signin button in visitor mode
parent
cfa4151cff
commit
58e68f8f80
@ -1,10 +1,21 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
import { appRouterSwitch } from "./routers";
|
import { appRouterSwitch } from "./routers";
|
||||||
|
import { locationService } from "./services";
|
||||||
import { useAppSelector } from "./store";
|
import { useAppSelector } from "./store";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const pathname = useAppSelector((state) => state.location.pathname);
|
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;
|
export default App;
|
||||||
|
|||||||
Loading…
Reference in New Issue