Skip to content

Commit ed32a25

Browse files
authored
Merge branch 'opensight-ui' into deps-bump-dependencies-and-devDependencies-(19)
2 parents a2534c6 + a0de56d commit ed32a25

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/web/routes.jsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import React from 'react';
6+
import {useState, useEffect} from 'react';
77

88
import {
99
BrowserRouter as Router,
@@ -16,6 +16,7 @@ import LocationObserver from 'web/components/observer/locationobserver';
1616
import SessionObserver from 'web/components/observer/sessionobserver';
1717

1818
import ConditionalRoute from 'web/components/conditionalRoute/ConditionalRoute';
19+
import Loading from 'web/components/loading/loading';
1920

2021
import LegacyOmpPage from './pages/omp';
2122
import Page from './pages/page';
@@ -255,8 +256,19 @@ const LoggedInRoutes = () => {
255256
};
256257

257258
const AppRoutes = () => {
259+
const [isLoading, setIsLoading] = useState(true);
258260
const isLoggedIn = useSelector(selectIsLoggedIn);
259261

262+
useEffect(() => {
263+
if (isLoggedIn !== undefined) {
264+
setIsLoading(false);
265+
}
266+
}, [isLoggedIn]);
267+
268+
if (isLoading) {
269+
return <Loading />;
270+
}
271+
260272
return (
261273
<Router>{isLoggedIn ? <LoggedInRoutes /> : <LoggedOutRoutes />}</Router>
262274
);

0 commit comments

Comments
 (0)