66 */
77
88import { FunctionComponent , PropsWithChildren , useEffect , useMemo , useState } from 'react' ;
9- import { FormattedMessage } from 'react-intl' ;
10- import { AuthenticationRouter , getPreLoginPath , initializeAuthenticationProd } from '@gridsuite/commons-ui' ;
9+ import { AuthenticationRouter , initializeAuthenticationProd } from '@gridsuite/commons-ui' ;
1110import {
1211 createBrowserRouter ,
13- Navigate ,
1412 Outlet ,
1513 RouteObject ,
1614 RouterProvider ,
@@ -22,67 +20,10 @@ import { useDispatch, useSelector } from 'react-redux';
2220import { AppState } from '../redux/reducer' ;
2321import { AppsMetadataSrv , UserAdminSrv } from '../services' ;
2422import { App } from '../components/App' ;
25- import { Profiles , Users , Groups } from '../pages' ;
26- import ErrorPage from './ErrorPage' ;
2723import { updateUserManagerDestructured } from '../redux/actions' ;
28- import HomePage from './HomePage' ;
2924import { getErrorMessage } from '../utils/error' ;
3025import { AppDispatch } from '../redux/store' ;
31-
32- export enum MainPaths {
33- users = 'users' ,
34- profiles = 'profiles' ,
35- groups = 'groups' ,
36- }
37-
38- export function appRoutes ( ) : RouteObject [ ] {
39- return [
40- {
41- path : '/' ,
42- errorElement : < ErrorPage /> ,
43- children : [
44- {
45- index : true ,
46- element : < HomePage /> ,
47- } ,
48- {
49- path : `/${ MainPaths . users } ` ,
50- element : < Users /> ,
51- handle : {
52- appBar_tab : MainPaths . users ,
53- } ,
54- } ,
55- {
56- path : `/${ MainPaths . profiles } ` ,
57- element : < Profiles /> ,
58- handle : {
59- appBar_tab : MainPaths . profiles ,
60- } ,
61- } ,
62- {
63- path : `/${ MainPaths . groups } ` ,
64- element : < Groups /> ,
65- handle : {
66- appBar_tab : MainPaths . groups ,
67- } ,
68- } ,
69- ] ,
70- } ,
71- {
72- path : '/sign-in-callback' ,
73- element : < Navigate replace to = { getPreLoginPath ( ) || '/' } /> ,
74- } ,
75- {
76- path : '/logout-callback' ,
77- element : < FormattedMessage tagName = "h1" id = "logoutFailed" /> ,
78- } ,
79- {
80- path : '*' ,
81- element : < FormattedMessage tagName = "h1" id = "pageNotFound" /> ,
82- errorElement : < ErrorPage /> ,
83- } ,
84- ] ;
85- }
26+ import { appRoutes } from './utils' ;
8627
8728const AuthRouter : FunctionComponent < {
8829 userManager : Parameters < typeof AuthenticationRouter > [ 0 ] [ 'userManager' ] ;
0 commit comments