@etsoo/materialui 1.2.96 → 1.2.97
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/ServiceApp.js +7 -3
- package/package.json +3 -3
- package/src/app/ServiceApp.ts +5 -2
package/lib/app/ServiceApp.js
CHANGED
|
@@ -74,7 +74,7 @@ export class ServiceApp extends ReactApp {
|
|
|
74
74
|
*/
|
|
75
75
|
async refreshToken(props) {
|
|
76
76
|
// Destruct
|
|
77
|
-
const { callback, data, relogin = false, showLoading = false } = props !== null && props !== void 0 ? props : {};
|
|
77
|
+
const { appApi, callback, data, relogin = false, showLoading = false } = props !== null && props !== void 0 ? props : {};
|
|
78
78
|
// Token
|
|
79
79
|
const token = this.getCacheToken();
|
|
80
80
|
if (token == null || token === "") {
|
|
@@ -112,7 +112,8 @@ export class ServiceApp extends ReactApp {
|
|
|
112
112
|
// User data
|
|
113
113
|
const userData = result.data;
|
|
114
114
|
// Use core system access token to service api to exchange service access token
|
|
115
|
-
const
|
|
115
|
+
const api = appApi ? appApi.api : this.serviceApi;
|
|
116
|
+
const serviceResult = await api.put("Auth/ExchangeToken", {
|
|
116
117
|
token: this.encryptEnhanced(userData.token, this.settings.serviceId.toString())
|
|
117
118
|
}, {
|
|
118
119
|
showLoading,
|
|
@@ -136,7 +137,10 @@ export class ServiceApp extends ReactApp {
|
|
|
136
137
|
return false;
|
|
137
138
|
}
|
|
138
139
|
// Login
|
|
139
|
-
|
|
140
|
+
if (appApi)
|
|
141
|
+
appApi.authorize(serviceResult.data.token);
|
|
142
|
+
else
|
|
143
|
+
this.userLoginEx(userData, refreshToken, serviceResult.data);
|
|
140
144
|
// Success callback
|
|
141
145
|
if (failCallback)
|
|
142
146
|
failCallback(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.97",
|
|
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.11.2",
|
|
51
51
|
"@emotion/react": "^11.11.1",
|
|
52
52
|
"@emotion/styled": "^11.11.0",
|
|
53
|
-
"@etsoo/appscript": "^1.4.
|
|
53
|
+
"@etsoo/appscript": "^1.4.35",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.28",
|
|
55
|
-
"@etsoo/react": "^1.7.
|
|
55
|
+
"@etsoo/react": "^1.7.7",
|
|
56
56
|
"@etsoo/shared": "^1.2.10",
|
|
57
57
|
"@mui/icons-material": "^5.14.7",
|
|
58
58
|
"@mui/material": "^5.14.7",
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -117,6 +117,7 @@ export class ServiceApp<
|
|
|
117
117
|
) {
|
|
118
118
|
// Destruct
|
|
119
119
|
const {
|
|
120
|
+
appApi,
|
|
120
121
|
callback,
|
|
121
122
|
data,
|
|
122
123
|
relogin = false,
|
|
@@ -169,7 +170,8 @@ export class ServiceApp<
|
|
|
169
170
|
const userData = result.data;
|
|
170
171
|
|
|
171
172
|
// Use core system access token to service api to exchange service access token
|
|
172
|
-
const
|
|
173
|
+
const api = appApi ? appApi.api : this.serviceApi;
|
|
174
|
+
const serviceResult = await api.put<ServiceLoginResult<U>>(
|
|
173
175
|
"Auth/ExchangeToken",
|
|
174
176
|
{
|
|
175
177
|
token: this.encryptEnhanced(
|
|
@@ -201,7 +203,8 @@ export class ServiceApp<
|
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
// Login
|
|
204
|
-
|
|
206
|
+
if (appApi) appApi.authorize(serviceResult.data.token);
|
|
207
|
+
else this.userLoginEx(userData, refreshToken, serviceResult.data);
|
|
205
208
|
|
|
206
209
|
// Success callback
|
|
207
210
|
if (failCallback) failCallback(true);
|