[FIX] Content being hidden after logging in

Ensure overflow is only disabled when login page is showing
This commit is contained in:
2021-09-11 17:43:33 +01:00
parent c1b04b0736
commit efc58ff390
3 changed files with 17 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ import PrivacyPolicy from "./PrivacyPolicy";
import Button from "./Button";
import { CheckRounded as CheckRoundedIcon } from "@material-ui/icons";
import RouteChangeTracker from './RouteChangeTracker';
import Cookies from 'universal-cookie';
import firebase from "firebase/app";
@@ -197,6 +199,7 @@ class App extends React.Component {
return (
<div className={this.state.theme}>
<Router>
<RouteChangeTracker />
{
this.state.user !== null
?

View File

@@ -23,7 +23,6 @@ export default function Login(props) {
},
};
document.body.style.overflow = "hidden";
document.title = "Login | Parandum";
return (

13
src/RouteChangeTracker.js Normal file
View File

@@ -0,0 +1,13 @@
import { withRouter } from "react-router-dom";
export default withRouter(function RouteChangeTracker({ history, logEvent }) {
history.listen((location, action) => {
if (location.pathname === "/login") {
document.body.style.overflow = "hidden";
} else {
document.body.style.overflow = "auto";
}
});
return null;
})