File tree 5 files changed +8
-15
lines changed
5 files changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ const AppTopBar: FunctionComponent = () => {
111
111
appLicense = { AppPackage . license }
112
112
onLogoutClick = { ( ) => logout ( dispatch , userManagerInstance ) }
113
113
onLogoClick = { ( ) => navigate ( '/' , { replace : true } ) }
114
- user = { user }
114
+ user = { user ?? undefined }
115
115
appsAndUrls = { appsAndUrls }
116
116
globalVersionPromise = { ( ) =>
117
117
AppsMetadataSrv . fetchVersion ( ) . then (
Original file line number Diff line number Diff line change 5
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
*/
7
7
8
- import { GsTheme } from '@gridsuite/commons-ui' ;
8
+ import { GsTheme , UserManagerState } from '@gridsuite/commons-ui' ;
9
9
import { PARAM_LANGUAGE } from '../utils/config-params' ;
10
10
import { Action } from 'redux' ;
11
11
import { AppState } from './reducer' ;
12
- import { UserManagerState } from '../routes' ;
13
12
14
13
export const UPDATE_USER_MANAGER_STATE = 'UPDATE_USER_MANAGER_STATE' ;
15
14
export type UserManagerAction = Readonly <
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
28
28
} from './actions' ;
29
29
import {
30
30
AuthenticationRouterErrorAction ,
31
+ AuthenticationRouterErrorState ,
31
32
CommonActions ,
32
33
CommonStoreState ,
33
34
GsLang ,
@@ -45,20 +46,20 @@ import {
45
46
USER ,
46
47
USER_VALIDATION_ERROR ,
47
48
UserAction ,
49
+ UserManagerState ,
48
50
UserValidationErrorAction ,
49
51
} from '@gridsuite/commons-ui' ;
50
52
import { PARAM_LANGUAGE , PARAM_THEME } from '../utils/config-params' ;
51
53
import { ReducerWithInitialState } from '@reduxjs/toolkit/dist/createReducer' ;
52
- import { UserManagerState } from '../routes' ;
53
54
54
55
export type AppState = CommonStoreState & {
55
56
computedLanguage : GsLangUser ;
56
57
[ PARAM_THEME ] : GsTheme ;
57
58
[ PARAM_LANGUAGE ] : GsLang ;
58
59
59
60
userManager : UserManagerState ;
60
- signInCallbackError : unknown ;
61
- authenticationRouterError : unknown ;
61
+ signInCallbackError : string | null ;
62
+ authenticationRouterError : AuthenticationRouterErrorState | null ;
62
63
showAuthenticationRouterLogin : boolean ;
63
64
} ;
64
65
Original file line number Diff line number Diff line change 5
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
*/
7
7
8
- import { UserManager } from 'oidc-client' ;
9
-
10
8
export * from './router' ;
11
-
12
- export type UserManagerState = {
13
- instance : UserManager | null ;
14
- error : string | null ;
15
- } ;
Original file line number Diff line number Diff line change @@ -15,12 +15,12 @@ export function getToken(user?: User): Token | null {
15
15
return ( user ?? getUser ( ) ) ?. id_token ?? null ;
16
16
}
17
17
18
- export function getUser ( ) : User {
18
+ export function getUser ( ) : User | null {
19
19
const state : AppState = store . getState ( ) ;
20
20
return state . user ;
21
21
}
22
22
23
- export function extractUserSub ( user : User ) : Promise < unknown > {
23
+ export function extractUserSub ( user : User | null ) : Promise < unknown > {
24
24
return new Promise ( ( resolve , reject ) => {
25
25
const sub = user ?. profile ?. sub ;
26
26
if ( ! sub ) {
You can’t perform that action at this time.
0 commit comments