[FIX] Content being hidden after logging in
Ensure overflow is only disabled when login page is showing
This commit is contained in:
@@ -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
|
||||
?
|
||||
|
||||
@@ -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
13
src/RouteChangeTracker.js
Normal 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;
|
||||
})
|
||||
Reference in New Issue
Block a user