[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 Button from "./Button";
|
||||||
import { CheckRounded as CheckRoundedIcon } from "@material-ui/icons";
|
import { CheckRounded as CheckRoundedIcon } from "@material-ui/icons";
|
||||||
|
|
||||||
|
import RouteChangeTracker from './RouteChangeTracker';
|
||||||
|
|
||||||
import Cookies from 'universal-cookie';
|
import Cookies from 'universal-cookie';
|
||||||
|
|
||||||
import firebase from "firebase/app";
|
import firebase from "firebase/app";
|
||||||
@@ -197,6 +199,7 @@ class App extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div className={this.state.theme}>
|
<div className={this.state.theme}>
|
||||||
<Router>
|
<Router>
|
||||||
|
<RouteChangeTracker />
|
||||||
{
|
{
|
||||||
this.state.user !== null
|
this.state.user !== null
|
||||||
?
|
?
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ export default function Login(props) {
|
|||||||
signInSuccessWithAuthResult: () => false,
|
signInSuccessWithAuthResult: () => false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
document.body.style.overflow = "hidden";
|
|
||||||
document.title = "Login | Parandum";
|
document.title = "Login | Parandum";
|
||||||
|
|
||||||
return (
|
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