@etsoo/react 1.5.55 → 1.5.56

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.
@@ -29,7 +29,6 @@ export declare abstract class CommonApp<U extends IUser = IUser, P extends IPage
29
29
  * @param props Props
30
30
  */
31
31
  refreshToken<D = RefreshTokenRQ>(props?: RefreshTokenProps<D>): Promise<boolean>;
32
- private loginFailed;
33
32
  /**
34
33
  * Try login
35
34
  * @param data Additional data
@@ -127,10 +127,6 @@ export class CommonApp extends ReactApp {
127
127
  }
128
128
  return success(result, callback);
129
129
  }
130
- loginFailed() {
131
- this.userUnauthorized();
132
- this.toLoginPage();
133
- }
134
130
  /**
135
131
  * Try login
136
132
  * @param data Additional data
@@ -144,18 +140,7 @@ export class CommonApp extends ReactApp {
144
140
  return false;
145
141
  // Refresh token
146
142
  return await this.refreshToken({
147
- callback: (result) => {
148
- if (result === true)
149
- return;
150
- const message = this.formatRefreshTokenResult(result);
151
- if (message == null) {
152
- this.loginFailed();
153
- return;
154
- }
155
- this.notifier.alert(message, () => {
156
- this.loginFailed();
157
- });
158
- },
143
+ callback: (result) => this.doRefreshTokenResult(result),
159
144
  data,
160
145
  showLoading,
161
146
  relogin: true
@@ -46,7 +46,6 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, P extends
46
46
  * @param props Props
47
47
  */
48
48
  refreshToken<D = RefreshTokenRQ>(props?: RefreshTokenProps<D>): Promise<boolean>;
49
- private loginFailed;
50
49
  /**
51
50
  * Service decrypt message
52
51
  * @param messageEncrypted Encrypted message
@@ -184,10 +184,6 @@ export class ServiceApp extends ReactApp {
184
184
  }
185
185
  return await success(result, callback);
186
186
  }
187
- loginFailed() {
188
- this.userUnauthorized();
189
- this.toLoginPage();
190
- }
191
187
  /**
192
188
  * Service decrypt message
193
189
  * @param messageEncrypted Encrypted message
@@ -220,21 +216,7 @@ export class ServiceApp extends ReactApp {
220
216
  return false;
221
217
  // Refresh token
222
218
  return await this.refreshToken({
223
- callback: (result) => {
224
- // Success
225
- if (result === true)
226
- return;
227
- // Clear cache
228
- this.clearCacheData();
229
- const message = this.formatRefreshTokenResult(result);
230
- if (message == null) {
231
- this.loginFailed();
232
- return;
233
- }
234
- this.notifier.alert(message, () => {
235
- this.loginFailed();
236
- });
237
- },
219
+ callback: (result) => this.doRefreshTokenResult(result),
238
220
  data,
239
221
  showLoading,
240
222
  relogin: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.5.55",
3
+ "version": "1.5.56",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -49,11 +49,11 @@
49
49
  "@emotion/css": "^11.10.0",
50
50
  "@emotion/react": "^11.10.0",
51
51
  "@emotion/styled": "^11.10.0",
52
- "@etsoo/appscript": "^1.2.65",
52
+ "@etsoo/appscript": "^1.2.69",
53
53
  "@etsoo/notificationbase": "^1.1.4",
54
54
  "@etsoo/shared": "^1.1.40",
55
55
  "@mui/icons-material": "^5.8.4",
56
- "@mui/material": "^5.9.2",
56
+ "@mui/material": "^5.9.3",
57
57
  "@types/pica": "^9.0.1",
58
58
  "@types/pulltorefreshjs": "^0.1.5",
59
59
  "@types/react": "^18.0.15",
@@ -74,16 +74,16 @@
74
74
  "react-window": "^1.8.7"
75
75
  },
76
76
  "devDependencies": {
77
- "@babel/cli": "^7.18.9",
78
- "@babel/core": "^7.18.9",
79
- "@babel/plugin-transform-runtime": "^7.18.9",
80
- "@babel/preset-env": "^7.18.9",
77
+ "@babel/cli": "^7.18.10",
78
+ "@babel/core": "^7.18.10",
79
+ "@babel/plugin-transform-runtime": "^7.18.10",
80
+ "@babel/preset-env": "^7.18.10",
81
81
  "@babel/runtime-corejs3": "^7.18.9",
82
82
  "@types/jest": "^28.1.6",
83
83
  "@types/react-test-renderer": "^18.0.0",
84
- "@typescript-eslint/eslint-plugin": "^5.31.0",
85
- "@typescript-eslint/parser": "^5.31.0",
86
- "eslint": "^8.20.0",
84
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
85
+ "@typescript-eslint/parser": "^5.32.0",
86
+ "eslint": "^8.21.0",
87
87
  "eslint-config-airbnb-base": "^15.0.0",
88
88
  "eslint-plugin-import": "^2.26.0",
89
89
  "eslint-plugin-react": "^7.30.1",
@@ -200,11 +200,6 @@ export abstract class CommonApp<
200
200
  return success(result, callback);
201
201
  }
202
202
 
203
- private loginFailed() {
204
- this.userUnauthorized();
205
- this.toLoginPage();
206
- }
207
-
208
203
  /**
209
204
  * Try login
210
205
  * @param data Additional data
@@ -221,19 +216,7 @@ export abstract class CommonApp<
221
216
 
222
217
  // Refresh token
223
218
  return await this.refreshToken({
224
- callback: (result) => {
225
- if (result === true) return;
226
-
227
- const message = this.formatRefreshTokenResult(result);
228
- if (message == null) {
229
- this.loginFailed();
230
- return;
231
- }
232
-
233
- this.notifier.alert(message, () => {
234
- this.loginFailed();
235
- });
236
- },
219
+ callback: (result) => this.doRefreshTokenResult(result),
237
220
  data,
238
221
  showLoading,
239
222
  relogin: true
@@ -271,11 +271,6 @@ export class ServiceApp<
271
271
  return await success(result, callback);
272
272
  }
273
273
 
274
- private loginFailed() {
275
- this.userUnauthorized();
276
- this.toLoginPage();
277
- }
278
-
279
274
  /**
280
275
  * Service decrypt message
281
276
  * @param messageEncrypted Encrypted message
@@ -320,23 +315,7 @@ export class ServiceApp<
320
315
 
321
316
  // Refresh token
322
317
  return await this.refreshToken({
323
- callback: (result) => {
324
- // Success
325
- if (result === true) return;
326
-
327
- // Clear cache
328
- this.clearCacheData();
329
-
330
- const message = this.formatRefreshTokenResult(result);
331
- if (message == null) {
332
- this.loginFailed();
333
- return;
334
- }
335
-
336
- this.notifier.alert(message, () => {
337
- this.loginFailed();
338
- });
339
- },
318
+ callback: (result) => this.doRefreshTokenResult(result),
340
319
  data,
341
320
  showLoading,
342
321
  relogin: true