@etsoo/materialui 1.4.14 → 1.4.16
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.
package/lib/app/ReactApp.js
CHANGED
|
@@ -203,15 +203,16 @@ export class ReactApp extends CoreApp {
|
|
|
203
203
|
* @returns Result
|
|
204
204
|
*/
|
|
205
205
|
async tryLogin(data) {
|
|
206
|
+
// Destruct
|
|
207
|
+
const { onFailure = () => {
|
|
208
|
+
this.toLoginPage(rest);
|
|
209
|
+
}, onSuccess, ...rest } = data ?? {};
|
|
206
210
|
// Check status
|
|
207
211
|
const result = await super.tryLogin(data);
|
|
208
212
|
if (!result) {
|
|
213
|
+
onFailure();
|
|
209
214
|
return false;
|
|
210
215
|
}
|
|
211
|
-
// Destruct
|
|
212
|
-
const { onFailure = () => {
|
|
213
|
-
this.toLoginPage(rest);
|
|
214
|
-
}, onSuccess, ...rest } = data ?? {};
|
|
215
216
|
// Refresh token
|
|
216
217
|
await this.refreshToken({
|
|
217
218
|
showLoading: data?.showLoading
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -141,9 +141,17 @@ export class ServiceApp extends ReactApp {
|
|
|
141
141
|
onFailure();
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
|
+
const coreTokenDecrypted = this.decrypt(coreToken);
|
|
145
|
+
if (!coreTokenDecrypted) {
|
|
146
|
+
onFailure();
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
144
149
|
params.onSuccess = () => {
|
|
145
150
|
// Call the core system API refresh token
|
|
146
|
-
this.apiRefreshTokenData(this.coreApi,
|
|
151
|
+
this.apiRefreshTokenData(this.coreApi, {
|
|
152
|
+
token: coreTokenDecrypted,
|
|
153
|
+
appId: this.settings.appId
|
|
154
|
+
}).then((data) => {
|
|
147
155
|
if (data == null)
|
|
148
156
|
return;
|
|
149
157
|
// Cache the core system refresh token
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.16",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@emotion/css": "^11.13.4",
|
|
51
51
|
"@emotion/react": "^11.13.3",
|
|
52
52
|
"@emotion/styled": "^11.13.0",
|
|
53
|
-
"@etsoo/appscript": "^1.5.
|
|
53
|
+
"@etsoo/appscript": "^1.5.58",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.52",
|
|
55
55
|
"@etsoo/react": "^1.7.89",
|
|
56
56
|
"@etsoo/shared": "^1.2.51",
|
|
@@ -3,10 +3,4 @@ import { IAppSettings } from "@etsoo/appscript";
|
|
|
3
3
|
/**
|
|
4
4
|
* Service app settings interface
|
|
5
5
|
*/
|
|
6
|
-
export interface IServiceAppSettings extends IAppSettings {
|
|
7
|
-
/**
|
|
8
|
-
* Application id
|
|
9
|
-
* 程序编号
|
|
10
|
-
*/
|
|
11
|
-
appId: number;
|
|
12
|
-
}
|
|
6
|
+
export interface IServiceAppSettings extends IAppSettings {}
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -425,12 +425,6 @@ export class ReactApp<
|
|
|
425
425
|
* @returns Result
|
|
426
426
|
*/
|
|
427
427
|
override async tryLogin(data?: AppTryLoginParams) {
|
|
428
|
-
// Check status
|
|
429
|
-
const result = await super.tryLogin(data);
|
|
430
|
-
if (!result) {
|
|
431
|
-
return false;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
428
|
// Destruct
|
|
435
429
|
const {
|
|
436
430
|
onFailure = () => {
|
|
@@ -440,6 +434,13 @@ export class ReactApp<
|
|
|
440
434
|
...rest
|
|
441
435
|
} = data ?? {};
|
|
442
436
|
|
|
437
|
+
// Check status
|
|
438
|
+
const result = await super.tryLogin(data);
|
|
439
|
+
if (!result) {
|
|
440
|
+
onFailure();
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
|
|
443
444
|
// Refresh token
|
|
444
445
|
await this.refreshToken(
|
|
445
446
|
{
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -199,9 +199,18 @@ export class ServiceApp<
|
|
|
199
199
|
return false;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
const coreTokenDecrypted = this.decrypt(coreToken);
|
|
203
|
+
if (!coreTokenDecrypted) {
|
|
204
|
+
onFailure();
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
|
|
202
208
|
params.onSuccess = () => {
|
|
203
209
|
// Call the core system API refresh token
|
|
204
|
-
this.apiRefreshTokenData(this.coreApi,
|
|
210
|
+
this.apiRefreshTokenData(this.coreApi, {
|
|
211
|
+
token: coreTokenDecrypted,
|
|
212
|
+
appId: this.settings.appId
|
|
213
|
+
}).then((data) => {
|
|
205
214
|
if (data == null) return;
|
|
206
215
|
|
|
207
216
|
// Cache the core system refresh token
|