Skip to content

Commit ed695c4

Browse files
authored
[Engage-43-4] Fix keycloak init, add basic logs (bcgov#124)
1 parent 66584a2 commit ed695c4

File tree

1 file changed

+4
-2
lines changed
  • met-web/src/services/userService

1 file changed

+4
-2
lines changed

met-web/src/services/userService/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ const KeycloakData = _kc;
2222
* Initializes Keycloak instance.
2323
*/
2424
const initKeycloak = async (dispatch: Dispatch<AnyAction>) => {
25-
if (KeycloakData.authenticated !== undefined) {
25+
console.log('[Keycloak] Starting initialization');
26+
if (KeycloakData.authenticated === true || KeycloakData.authenticated === false) {
27+
console.log('[Keycloak] Already initialized');
2628
return;
2729
}
2830
try {
@@ -68,7 +70,7 @@ const initKeycloak = async (dispatch: Dispatch<AnyAction>) => {
6870
dispatch(userAuthentication(KeycloakData.authenticated ? true : false));
6971
refreshToken(dispatch);
7072
} catch (err) {
71-
console.error('Keycloak initialization error:', err);
73+
console.error('[Keycloak] Keycloak initialization error:', err);
7274
dispatch(userAuthentication(false));
7375
}
7476
};

0 commit comments

Comments
 (0)