aboutsummaryrefslogtreecommitdiff
path: root/modern/src/MainPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-06-06 15:07:13 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-06-06 15:07:13 -0700
commitcc03e41dd7f9f401797f39eb08e7d4617d624a2f (patch)
tree73e35b23c5d4d0f06382ec3ebd4c4da86611e65d /modern/src/MainPage.js
parentd04cd5a9ca34f0528f3db6361641d20bc1a13320 (diff)
downloadtrackermap-web-cc03e41dd7f9f401797f39eb08e7d4617d624a2f.tar.gz
trackermap-web-cc03e41dd7f9f401797f39eb08e7d4617d624a2f.tar.bz2
trackermap-web-cc03e41dd7f9f401797f39eb08e7d4617d624a2f.zip
Fix duplicate loading
Diffstat (limited to 'modern/src/MainPage.js')
-rw-r--r--modern/src/MainPage.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js
index c70e8169..f81d5e74 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');