@etsoo/materialui 1.4.58 → 1.4.59

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.
@@ -239,7 +239,7 @@ export class ReactApp extends CoreApp {
239
239
  // Check status
240
240
  const result = await super.tryLogin(data);
241
241
  if (!result) {
242
- onFailure();
242
+ onFailure("ReactAppSuperTryLoginFailed");
243
243
  return false;
244
244
  }
245
245
  // Refresh token
@@ -250,12 +250,12 @@ export class ReactApp extends CoreApp {
250
250
  onSuccess?.();
251
251
  }
252
252
  else if (result === false) {
253
- onFailure();
253
+ onFailure("ReactAppRefreshTokenFailed");
254
254
  }
255
- else if (result != null && this.tryLoginIgnoreResult(result)) {
256
- // Ignore the result warning
257
- return true;
255
+ else if (result != null && !this.tryLoginIgnoreResult(result)) {
256
+ onFailure("ReactAppRefreshTokenFailed: " + JSON.stringify(result));
258
257
  }
258
+ // Ignore other results
259
259
  });
260
260
  return true;
261
261
  }
@@ -38,6 +38,7 @@ export class ServiceApp extends ReactApp {
38
38
  this.coreEndpoint = coreEndpoint;
39
39
  this.coreOrigin = new URL(coreEndpoint.webUrl).origin;
40
40
  this.coreApi = this.createApi(coreName, coreEndpoint);
41
+ this.keepLogin = true;
41
42
  }
42
43
  /**
43
44
  * Load core system UI
@@ -188,19 +189,20 @@ export class ServiceApp extends ReactApp {
188
189
  params ??= {};
189
190
  let { onFailure, onSuccess, ...rest } = params;
190
191
  if (onFailure == null) {
191
- onFailure = params.onFailure = () => {
192
+ onFailure = params.onFailure = (type) => {
193
+ console.log(`Try login failed: ${type}.`);
192
194
  this.toLoginPage(rest);
193
195
  };
194
196
  }
195
197
  // Check core system token
196
198
  const coreToken = this.storage.getData(coreTokenKey);
197
199
  if (!coreToken) {
198
- onFailure();
200
+ onFailure("ServiceAppCoreTokenNoData");
199
201
  return false;
200
202
  }
201
203
  const coreTokenDecrypted = this.decrypt(coreToken);
202
204
  if (!coreTokenDecrypted) {
203
- onFailure();
205
+ onFailure("ServiceAppCoreTokenNoDecryptedData");
204
206
  return false;
205
207
  }
206
208
  params.onSuccess = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.4.58",
3
+ "version": "1.4.59",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -35,9 +35,9 @@
35
35
  "@emotion/css": "^11.13.5",
36
36
  "@emotion/react": "^11.14.0",
37
37
  "@emotion/styled": "^11.14.0",
38
- "@etsoo/appscript": "^1.5.82",
38
+ "@etsoo/appscript": "^1.5.83",
39
39
  "@etsoo/notificationbase": "^1.1.54",
40
- "@etsoo/react": "^1.8.16",
40
+ "@etsoo/react": "^1.8.17",
41
41
  "@etsoo/shared": "^1.2.55",
42
42
  "@mui/icons-material": "^6.3.1",
43
43
  "@mui/material": "^6.3.1",
@@ -437,7 +437,7 @@ export class ReactApp<
437
437
  // Check status
438
438
  const result = await super.tryLogin(data);
439
439
  if (!result) {
440
- onFailure();
440
+ onFailure("ReactAppSuperTryLoginFailed");
441
441
  return false;
442
442
  }
443
443
 
@@ -450,11 +450,11 @@ export class ReactApp<
450
450
  if (result === true) {
451
451
  onSuccess?.();
452
452
  } else if (result === false) {
453
- onFailure();
454
- } else if (result != null && this.tryLoginIgnoreResult(result)) {
455
- // Ignore the result warning
456
- return true;
453
+ onFailure("ReactAppRefreshTokenFailed");
454
+ } else if (result != null && !this.tryLoginIgnoreResult(result)) {
455
+ onFailure("ReactAppRefreshTokenFailed: " + JSON.stringify(result));
457
456
  }
457
+ // Ignore other results
458
458
  }
459
459
  );
460
460
 
@@ -66,6 +66,8 @@ export class ServiceApp<
66
66
  this.coreEndpoint = coreEndpoint;
67
67
  this.coreOrigin = new URL(coreEndpoint.webUrl).origin;
68
68
  this.coreApi = this.createApi(coreName, coreEndpoint);
69
+
70
+ this.keepLogin = true;
69
71
  }
70
72
 
71
73
  /**
@@ -252,7 +254,8 @@ export class ServiceApp<
252
254
  let { onFailure, onSuccess, ...rest } = params;
253
255
 
254
256
  if (onFailure == null) {
255
- onFailure = params.onFailure = () => {
257
+ onFailure = params.onFailure = (type) => {
258
+ console.log(`Try login failed: ${type}.`);
256
259
  this.toLoginPage(rest);
257
260
  };
258
261
  }
@@ -260,13 +263,13 @@ export class ServiceApp<
260
263
  // Check core system token
261
264
  const coreToken = this.storage.getData<string>(coreTokenKey);
262
265
  if (!coreToken) {
263
- onFailure();
266
+ onFailure("ServiceAppCoreTokenNoData");
264
267
  return false;
265
268
  }
266
269
 
267
270
  const coreTokenDecrypted = this.decrypt(coreToken);
268
271
  if (!coreTokenDecrypted) {
269
- onFailure();
272
+ onFailure("ServiceAppCoreTokenNoDecryptedData");
270
273
  return false;
271
274
  }
272
275