aboutsummaryrefslogtreecommitdiff
path: root/modern/src/App.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/App.js')
-rw-r--r--modern/src/App.js34
1 files changed, 22 insertions, 12 deletions
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 (
<>
<CssBaseline />
<SocketController />
<Switch>
- <Route exact path='/' component={MainPage} />
<Route exact path='/login' component={LoginPage} />
- <Route exact path='/replay' component={ReplayPage} />
- <Route exact path='/position/:id?' component={PositionPage} />
- <Route exact path='/user/:id?' component={UserPage} />
- <Route exact path='/device/:id?' component={DevicePage} />
- <Route exact path='/reports/route' component={RouteReportPage} />
- <Route exact path='/settings/notifications' component={NotificationsPage} />
- <Route exact path='/settings/notification/:id?' component={NotificationPage} />
- <Route exact path='/settings/groups' component={GroupsPage} />
- <Route exact path='/settings/group/:id?' component={GroupPage} />
- <Route exact path='/admin/server' component={ServerPage} />
- <Route exact path='/admin/users' component={UsersPage} />
+ <Route>
+ {!initialized ? (<LinearProgress />) : (
+ <Switch>
+ <Route exact path='/' component={MainPage} />
+ <Route exact path='/replay' component={ReplayPage} />
+ <Route exact path='/position/:id?' component={PositionPage} />
+ <Route exact path='/user/:id?' component={UserPage} />
+ <Route exact path='/device/:id?' component={DevicePage} />
+ <Route exact path='/reports/route' component={RouteReportPage} />
+ <Route exact path='/settings/notifications' component={NotificationsPage} />
+ <Route exact path='/settings/notification/:id?' component={NotificationPage} />
+ <Route exact path='/settings/groups' component={GroupsPage} />
+ <Route exact path='/settings/group/:id?' component={GroupPage} />
+ <Route exact path='/admin/server' component={ServerPage} />
+ <Route exact path='/admin/users' component={UsersPage} />
+ </Switch>
+ )}
+ </Route>
</Switch>
</>
);