From cc03e41dd7f9f401797f39eb08e7d4617d624a2f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 6 Jun 2020 15:07:13 -0700 Subject: Fix duplicate loading --- modern/src/MainPage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modern/src/MainPage.js') diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js index c70e816..f81d5e7 100644 --- a/modern/src/MainPage.js +++ b/modern/src/MainPage.js @@ -40,13 +40,14 @@ const useStyles = makeStyles(theme => ({ })); const MainPage = ({ width }) => { - const [loading, setLoading] = useState(true); + const [loading, setLoading] = useState(!document.authenticated); const classes = useStyles(); const history = useHistory(); useEffect(() => { fetch('/api/session').then(response => { if (response.ok) { + document.authenticated = true; setLoading(false); } else { history.push('/login'); -- cgit v1.2.3