From 162000dc250b1be24fd7e6dd4e9c3883ca6581c5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 1 Nov 2020 21:57:47 -0800 Subject: Improve session handing --- modern/src/App.js | 34 ++++++++++++++++++++++------------ modern/src/MainPage.js | 5 +---- 2 files changed, 23 insertions(+), 16 deletions(-) (limited to 'modern') diff --git a/modern/src/App.js b/modern/src/App.js index 6fd5c00..243489e 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -15,26 +15,36 @@ import GroupsPage from './settings/GroupsPage'; import GroupPage from './settings/GroupPage'; import PositionPage from './PositionPage'; import ReplayPage from './reports/ReplayPage'; +import { useSelector } from 'react-redux'; +import { LinearProgress } from '@material-ui/core'; const App = () => { + const initialized = useSelector(state => !!state.session.server && !!state.session.user); + return ( <> - - - - - - - - - - - - + + {!initialized ? () : ( + + + + + + + + + + + + + + + )} + ); diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js index d277f28..58bf83a 100644 --- a/modern/src/MainPage.js +++ b/modern/src/MainPage.js @@ -1,9 +1,7 @@ import React from 'react'; -import { useSelector } from 'react-redux'; import { isWidthUp, makeStyles, withWidth } from '@material-ui/core'; import Drawer from '@material-ui/core/Drawer'; import ContainerDimensions from 'react-container-dimensions'; -import LinearProgress from '@material-ui/core/LinearProgress'; import DevicesList from './DevicesList'; import MainToolbar from './MainToolbar'; import Map from './map/Map'; @@ -42,10 +40,9 @@ const useStyles = makeStyles(theme => ({ })); const MainPage = ({ width }) => { - const initialized = useSelector(state => !!state.session.server && !!state.session.user); const classes = useStyles(); - return !initialized ? () : ( + return (
-- cgit v1.2.3