@etsoo/react 1.3.71 → 1.3.72
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.d.ts +5 -5
- package/lib/app/ServiceApp.js +8 -8
- package/package.json +1 -1
- package/src/app/ServiceApp.ts +11 -11
package/lib/app/ServiceApp.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ export declare class ServiceApp<P extends IServicePageData = IServicePageData, U
|
|
|
17
17
|
*/
|
|
18
18
|
readonly serviceApi: IApi;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Service user
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
serviceUser?: ISmartERPUser;
|
|
23
23
|
/**
|
|
24
24
|
* Service passphrase
|
|
25
25
|
*/
|
|
@@ -61,9 +61,9 @@ export declare class ServiceApp<P extends IServicePageData = IServicePageData, U
|
|
|
61
61
|
tryLogin<D extends {} = {}>(data?: D): Promise<boolean>;
|
|
62
62
|
/**
|
|
63
63
|
* User login extended
|
|
64
|
-
* @param user
|
|
64
|
+
* @param user Core system user
|
|
65
65
|
* @param refreshToken Refresh token
|
|
66
|
-
* @param
|
|
66
|
+
* @param serviceUser Service user
|
|
67
67
|
*/
|
|
68
|
-
userLoginEx(user:
|
|
68
|
+
userLoginEx(user: ISmartERPUser, refreshToken: string, serviceUser: IServiceUser): void;
|
|
69
69
|
}
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -112,7 +112,7 @@ export class ServiceApp extends ReactApp {
|
|
|
112
112
|
return false;
|
|
113
113
|
}
|
|
114
114
|
// Login
|
|
115
|
-
this.userLoginEx(
|
|
115
|
+
this.userLoginEx(userData, refreshToken, serviceResult.data);
|
|
116
116
|
// Success callback
|
|
117
117
|
if (failCallback)
|
|
118
118
|
failCallback(true);
|
|
@@ -216,20 +216,20 @@ export class ServiceApp extends ReactApp {
|
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* User login extended
|
|
219
|
-
* @param user
|
|
219
|
+
* @param user Core system user
|
|
220
220
|
* @param refreshToken Refresh token
|
|
221
|
-
* @param
|
|
221
|
+
* @param serviceUser Service user
|
|
222
222
|
*/
|
|
223
|
-
userLoginEx(user, refreshToken,
|
|
223
|
+
userLoginEx(user, refreshToken, serviceUser) {
|
|
224
224
|
var _a;
|
|
225
225
|
// Service user login
|
|
226
226
|
this.servicePassphrase =
|
|
227
|
-
(_a = this.decrypt(
|
|
227
|
+
(_a = this.decrypt(serviceUser.serviceDeviceId, this.settings.serviceId.toString())) !== null && _a !== void 0 ? _a : '';
|
|
228
228
|
// Keep = true, means service could hold the refresh token for long access
|
|
229
229
|
super.userLogin(user, refreshToken, true);
|
|
230
|
-
//
|
|
231
|
-
this.
|
|
230
|
+
// Service user
|
|
231
|
+
this.serviceUser = serviceUser;
|
|
232
232
|
// Service API token
|
|
233
|
-
this.serviceApi.authorize(this.settings.authScheme,
|
|
233
|
+
this.serviceApi.authorize(this.settings.authScheme, serviceUser.token);
|
|
234
234
|
}
|
|
235
235
|
}
|
package/package.json
CHANGED
package/src/app/ServiceApp.ts
CHANGED
|
@@ -31,9 +31,9 @@ export class ServiceApp<
|
|
|
31
31
|
readonly serviceApi: IApi;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Service user
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
serviceUser?: ISmartERPUser;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Service passphrase
|
|
@@ -166,7 +166,7 @@ export class ServiceApp<
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
// Login
|
|
169
|
-
this.userLoginEx(
|
|
169
|
+
this.userLoginEx(userData, refreshToken, serviceResult.data);
|
|
170
170
|
|
|
171
171
|
// Success callback
|
|
172
172
|
if (failCallback) failCallback(true);
|
|
@@ -309,29 +309,29 @@ export class ServiceApp<
|
|
|
309
309
|
|
|
310
310
|
/**
|
|
311
311
|
* User login extended
|
|
312
|
-
* @param user
|
|
312
|
+
* @param user Core system user
|
|
313
313
|
* @param refreshToken Refresh token
|
|
314
|
-
* @param
|
|
314
|
+
* @param serviceUser Service user
|
|
315
315
|
*/
|
|
316
316
|
userLoginEx(
|
|
317
|
-
user:
|
|
317
|
+
user: ISmartERPUser,
|
|
318
318
|
refreshToken: string,
|
|
319
|
-
|
|
319
|
+
serviceUser: IServiceUser
|
|
320
320
|
): void {
|
|
321
321
|
// Service user login
|
|
322
322
|
this.servicePassphrase =
|
|
323
323
|
this.decrypt(
|
|
324
|
-
|
|
324
|
+
serviceUser.serviceDeviceId,
|
|
325
325
|
this.settings.serviceId.toString()
|
|
326
326
|
) ?? '';
|
|
327
327
|
|
|
328
328
|
// Keep = true, means service could hold the refresh token for long access
|
|
329
329
|
super.userLogin(user, refreshToken, true);
|
|
330
330
|
|
|
331
|
-
//
|
|
332
|
-
this.
|
|
331
|
+
// Service user
|
|
332
|
+
this.serviceUser = serviceUser;
|
|
333
333
|
|
|
334
334
|
// Service API token
|
|
335
|
-
this.serviceApi.authorize(this.settings.authScheme,
|
|
335
|
+
this.serviceApi.authorize(this.settings.authScheme, serviceUser.token);
|
|
336
336
|
}
|
|
337
337
|
}
|