@etsoo/materialui 1.4.7 → 1.4.9
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/CommonApp.js +1 -1
- package/lib/app/ServiceApp.js +9 -3
- package/package.json +3 -3
- package/src/app/CommonApp.ts +1 -1
- package/src/app/ServiceApp.ts +12 -3
package/lib/app/CommonApp.js
CHANGED
package/lib/app/ServiceApp.js
CHANGED
|
@@ -118,17 +118,23 @@ export class ServiceApp extends ReactApp {
|
|
|
118
118
|
* @param params Login parameters
|
|
119
119
|
*/
|
|
120
120
|
async tryLogin(params) {
|
|
121
|
+
// Current callback
|
|
122
|
+
params ?? (params = {});
|
|
123
|
+
const onSuccess = params.onSuccess;
|
|
124
|
+
const onFailure = params.onFailure;
|
|
121
125
|
// Check core system token
|
|
122
126
|
const coreToken = this.storage.getData(coreTokenKey);
|
|
123
|
-
if (!coreToken)
|
|
127
|
+
if (!coreToken) {
|
|
128
|
+
onFailure?.();
|
|
124
129
|
return false;
|
|
125
|
-
|
|
126
|
-
const onSuccess = params.onSuccess;
|
|
130
|
+
}
|
|
127
131
|
params.onSuccess = () => {
|
|
128
132
|
// Call the core system API refresh token
|
|
129
133
|
this.apiRefreshTokenData(this.coreApi, coreToken).then((data) => {
|
|
130
134
|
if (data == null)
|
|
131
135
|
return;
|
|
136
|
+
// Cache the core system refresh token
|
|
137
|
+
this.storage.setData(coreTokenKey, data.refreshToken);
|
|
132
138
|
this.exchangeTokenAll(data, coreName);
|
|
133
139
|
onSuccess?.();
|
|
134
140
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,9 +50,9 @@
|
|
|
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.50",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.49",
|
|
55
|
-
"@etsoo/react": "^1.7.
|
|
55
|
+
"@etsoo/react": "^1.7.83",
|
|
56
56
|
"@etsoo/shared": "^1.2.48",
|
|
57
57
|
"@mui/icons-material": "^6.1.4",
|
|
58
58
|
"@mui/material": "^6.1.4",
|
package/src/app/CommonApp.ts
CHANGED
package/src/app/ServiceApp.ts
CHANGED
|
@@ -172,17 +172,26 @@ export class ServiceApp<
|
|
|
172
172
|
* @param params Login parameters
|
|
173
173
|
*/
|
|
174
174
|
override async tryLogin(params?: AppTryLoginParams) {
|
|
175
|
+
// Current callback
|
|
176
|
+
params ??= {};
|
|
177
|
+
const onSuccess = params.onSuccess;
|
|
178
|
+
const onFailure = params.onFailure;
|
|
179
|
+
|
|
175
180
|
// Check core system token
|
|
176
181
|
const coreToken = this.storage.getData<string>(coreTokenKey);
|
|
177
|
-
if (!coreToken)
|
|
182
|
+
if (!coreToken) {
|
|
183
|
+
onFailure?.();
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
178
186
|
|
|
179
|
-
params ??= {};
|
|
180
|
-
const onSuccess = params.onSuccess;
|
|
181
187
|
params.onSuccess = () => {
|
|
182
188
|
// Call the core system API refresh token
|
|
183
189
|
this.apiRefreshTokenData(this.coreApi, coreToken).then((data) => {
|
|
184
190
|
if (data == null) return;
|
|
185
191
|
|
|
192
|
+
// Cache the core system refresh token
|
|
193
|
+
this.storage.setData(coreTokenKey, data.refreshToken);
|
|
194
|
+
|
|
186
195
|
this.exchangeTokenAll(data, coreName);
|
|
187
196
|
|
|
188
197
|
onSuccess?.();
|