Skip to content

Commit a2f20ad

Browse files
fix last problems
1 parent 71384a3 commit a2f20ad

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

src/components/App/app-top-bar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const AppTopBar: FunctionComponent = () => {
111111
appLicense={AppPackage.license}
112112
onLogoutClick={() => logout(dispatch, userManagerInstance)}
113113
onLogoClick={() => navigate('/', { replace: true })}
114-
user={user}
114+
user={user ?? undefined}
115115
appsAndUrls={appsAndUrls}
116116
globalVersionPromise={() =>
117117
AppsMetadataSrv.fetchVersion().then(

src/redux/actions.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
77

8-
import { GsTheme } from '@gridsuite/commons-ui';
8+
import { GsTheme, UserManagerState } from '@gridsuite/commons-ui';
99
import { PARAM_LANGUAGE } from '../utils/config-params';
1010
import { Action } from 'redux';
1111
import { AppState } from './reducer';
12-
import { UserManagerState } from '../routes';
1312

1413
export const UPDATE_USER_MANAGER_STATE = 'UPDATE_USER_MANAGER_STATE';
1514
export type UserManagerAction = Readonly<

src/redux/reducer.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
} from './actions';
2929
import {
3030
AuthenticationRouterErrorAction,
31+
AuthenticationRouterErrorState,
3132
CommonActions,
3233
CommonStoreState,
3334
GsLang,
@@ -45,20 +46,20 @@ import {
4546
USER,
4647
USER_VALIDATION_ERROR,
4748
UserAction,
49+
UserManagerState,
4850
UserValidationErrorAction,
4951
} from '@gridsuite/commons-ui';
5052
import { PARAM_LANGUAGE, PARAM_THEME } from '../utils/config-params';
5153
import { ReducerWithInitialState } from '@reduxjs/toolkit/dist/createReducer';
52-
import { UserManagerState } from '../routes';
5354

5455
export type AppState = CommonStoreState & {
5556
computedLanguage: GsLangUser;
5657
[PARAM_THEME]: GsTheme;
5758
[PARAM_LANGUAGE]: GsLang;
5859

5960
userManager: UserManagerState;
60-
signInCallbackError: unknown;
61-
authenticationRouterError: unknown;
61+
signInCallbackError: string | null;
62+
authenticationRouterError: AuthenticationRouterErrorState | null;
6263
showAuthenticationRouterLogin: boolean;
6364
};
6465

src/routes/index.ts

-7
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,4 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
77

8-
import { UserManager } from 'oidc-client';
9-
108
export * from './router';
11-
12-
export type UserManagerState = {
13-
instance: UserManager | null;
14-
error: string | null;
15-
};

src/utils/api.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ export function getToken(user?: User): Token | null {
1515
return (user ?? getUser())?.id_token ?? null;
1616
}
1717

18-
export function getUser(): User {
18+
export function getUser(): User | null {
1919
const state: AppState = store.getState();
2020
return state.user;
2121
}
2222

23-
export function extractUserSub(user: User): Promise<unknown> {
23+
export function extractUserSub(user: User | null): Promise<unknown> {
2424
return new Promise((resolve, reject) => {
2525
const sub = user?.profile?.sub;
2626
if (!sub) {

0 commit comments

Comments
 (0)