File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 3
3
* SPDX-License-Identifier: AGPL-3.0-or-later
4
4
*/
5
5
6
- import React from 'react' ;
6
+ import { useState , useEffect } from 'react' ;
7
7
8
8
import {
9
9
BrowserRouter as Router ,
@@ -16,6 +16,7 @@ import LocationObserver from 'web/components/observer/locationobserver';
16
16
import SessionObserver from 'web/components/observer/sessionobserver' ;
17
17
18
18
import ConditionalRoute from 'web/components/conditionalRoute/ConditionalRoute' ;
19
+ import Loading from 'web/components/loading/loading' ;
19
20
20
21
import LegacyOmpPage from './pages/omp' ;
21
22
import Page from './pages/page' ;
@@ -255,8 +256,19 @@ const LoggedInRoutes = () => {
255
256
} ;
256
257
257
258
const AppRoutes = ( ) => {
259
+ const [ isLoading , setIsLoading ] = useState ( true ) ;
258
260
const isLoggedIn = useSelector ( selectIsLoggedIn ) ;
259
261
262
+ useEffect ( ( ) => {
263
+ if ( isLoggedIn !== undefined ) {
264
+ setIsLoading ( false ) ;
265
+ }
266
+ } , [ isLoggedIn ] ) ;
267
+
268
+ if ( isLoading ) {
269
+ return < Loading /> ;
270
+ }
271
+
260
272
return (
261
273
< Router > { isLoggedIn ? < LoggedInRoutes /> : < LoggedOutRoutes /> } </ Router >
262
274
) ;
You can’t perform that action at this time.
0 commit comments