@gridsuite/commons-ui 0.24.0 → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -147,6 +147,15 @@ function logout(dispatch, userManagerInstance) {
147
147
  function dispatchUser(dispatch, userManagerInstance) {
148
148
  return userManagerInstance.getUser().then(function (user) {
149
149
  if (user) {
150
+ var now = parseInt(Date.now() / 1000);
151
+ var exp = (0, _jwtDecode["default"])(user.id_token).exp;
152
+ var idTokenExpiresIn = exp - now;
153
+
154
+ if (idTokenExpiresIn < 0) {
155
+ console.debug('User token is expired and will not be dispatched');
156
+ return;
157
+ }
158
+
150
159
  console.debug('User has been successfully loaded from store.');
151
160
  return dispatch((0, _actions.setLoggedUser)(user));
152
161
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "engines": {
6
6
  "npm": "<=6",