@etsoo/appscript 1.4.5 → 1.4.7

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.
@@ -163,8 +163,8 @@ test('Tests for encrypt / decrypt', async () => {
163
163
  const passphrase = 'My password';
164
164
 
165
165
  // Act
166
- const encrypted = await app.encrypt(input, passphrase);
167
- const plain = await app.decrypt(encrypted, passphrase);
166
+ const encrypted = app.encrypt(input, passphrase);
167
+ const plain = app.decrypt(encrypted, passphrase);
168
168
  expect(plain).toEqual(input);
169
169
  });
170
170
 
@@ -174,8 +174,8 @@ test('Tests for encryptEnhanced / decryptEnhanced', async () => {
174
174
  const passphrase = 'My password';
175
175
 
176
176
  // Act
177
- const encrypted = await app.encryptEnhanced(input, passphrase);
178
- const plain = await app.decryptEnhanced(encrypted, passphrase);
177
+ const encrypted = app.encryptEnhanced(input, passphrase);
178
+ const plain = app.decryptEnhanced(encrypted, passphrase);
179
179
  expect(plain).toEqual(input);
180
180
  });
181
181
 
@@ -221,7 +221,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
221
221
  * @param culture New culture definition
222
222
  * @param onReady On ready callback
223
223
  */
224
- changeCulture(culture: DataTypes.CultureDefinition, onReady?: (resources: DataTypes.StringRecord) => void): void;
224
+ changeCulture(culture: DataTypes.CultureDefinition): Promise<DataTypes.StringRecord>;
225
225
  /**
226
226
  * Update current region label
227
227
  */
@@ -35,7 +35,6 @@ const ActionResultError_1 = require("../result/ActionResultError");
35
35
  const IApp_1 = require("./IApp");
36
36
  const UserRole_1 = require("./UserRole");
37
37
  let CJ;
38
- Promise.resolve().then(() => __importStar(require('crypto-js'))).then((result) => (CJ = result));
39
38
  /**
40
39
  * Core application
41
40
  */
@@ -153,12 +152,16 @@ class CoreApp {
153
152
  this.fields = IApp_1.appFields.reduce((a, v) => ({ ...a, [v]: 'smarterp-' + v + '-' + name }), {});
154
153
  // Device id
155
154
  this._deviceId = storage.getData(this.fields.deviceId, '');
156
- // Restore
157
- this.restore();
158
155
  this.setApi(api);
159
156
  const { currentCulture, currentRegion } = settings;
160
- this.changeCulture(currentCulture, () => this.setup());
161
- this.changeRegion(currentRegion);
157
+ // Load resources
158
+ Promise.all([
159
+ Promise.resolve().then(() => __importStar(require('crypto-js'))),
160
+ this.changeCulture(currentCulture)
161
+ ]).then(([cj, _resources]) => {
162
+ (CJ = cj), this.changeRegion(currentRegion);
163
+ this.setup();
164
+ });
162
165
  }
163
166
  getDeviceId() {
164
167
  return this.deviceId.substring(0, 15);
@@ -220,7 +223,7 @@ class CoreApp {
220
223
  const passphraseEncrypted = this.storage.getData(this.fields.devicePassphrase);
221
224
  if (passphraseEncrypted) {
222
225
  // this.name to identifier different app's secret
223
- const passphraseDecrypted = await this.decrypt(passphraseEncrypted, this.name);
226
+ const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
224
227
  if (passphraseDecrypted != null) {
225
228
  // Add the device to the list
226
229
  devices.push(d);
@@ -398,7 +401,7 @@ class CoreApp {
398
401
  return false;
399
402
  // Decrypt
400
403
  // Should be done within 120 seconds after returning from the backend
401
- const passphrase = await this.decrypt(data.passphrase, timestamp.toString());
404
+ const passphrase = this.decrypt(data.passphrase, timestamp.toString());
402
405
  if (passphrase == null)
403
406
  return false;
404
407
  // Update device id and cache it
@@ -410,10 +413,10 @@ class CoreApp {
410
413
  this.storage.setPersistedData(this.fields.devices, devices);
411
414
  // Current passphrase
412
415
  this.passphrase = passphrase;
413
- this.storage.setData(this.fields.devicePassphrase, await this.encrypt(passphrase, this.name));
416
+ this.storage.setData(this.fields.devicePassphrase, this.encrypt(passphrase, this.name));
414
417
  // Previous passphrase
415
418
  if (data.previousPassphrase) {
416
- const prev = await this.decrypt(data.previousPassphrase, timestamp.toString());
419
+ const prev = this.decrypt(data.previousPassphrase, timestamp.toString());
417
420
  // Update
418
421
  const fields = this.initCallEncryptedUpdateFields();
419
422
  for (const field of fields) {
@@ -428,10 +431,10 @@ class CoreApp {
428
431
  const enhanced = currentValue.indexOf('!') >= 8;
429
432
  let newValueSource;
430
433
  if (enhanced) {
431
- newValueSource = await this.decryptEnhanced(currentValue, prev, 12);
434
+ newValueSource = this.decryptEnhanced(currentValue, prev, 12);
432
435
  }
433
436
  else {
434
- newValueSource = await this.decrypt(currentValue, prev);
437
+ newValueSource = this.decrypt(currentValue, prev);
435
438
  }
436
439
  if (newValueSource == null || newValueSource === '') {
437
440
  // Reset the field
@@ -439,8 +442,8 @@ class CoreApp {
439
442
  continue;
440
443
  }
441
444
  const newValue = enhanced
442
- ? await this.encryptEnhanced(newValueSource)
443
- : await this.encrypt(newValueSource);
445
+ ? this.encryptEnhanced(newValueSource)
446
+ : this.encrypt(newValueSource);
444
447
  this.storage.setData(field, newValue);
445
448
  }
446
449
  }
@@ -527,12 +530,13 @@ class CoreApp {
527
530
  * @param culture New culture definition
528
531
  * @param onReady On ready callback
529
532
  */
530
- changeCulture(culture, onReady) {
533
+ async changeCulture(culture) {
531
534
  // Name
532
535
  const { name } = culture;
533
536
  // Same?
534
- if (this._culture === name)
535
- return;
537
+ let resources = culture.resources;
538
+ if (this._culture === name && typeof resources === 'object')
539
+ return resources;
536
540
  // Save the cultrue to local storage
537
541
  this.storage.setPersistedData(shared_1.DomUtils.CultureField, name);
538
542
  // Change the API's Content-Language header
@@ -542,19 +546,13 @@ class CoreApp {
542
546
  this._culture = name;
543
547
  // Hold the current resources
544
548
  this.settings.currentCulture = culture;
545
- if (typeof culture.resources !== 'object') {
546
- culture.resources().then((result) => {
547
- culture.resources = result;
548
- this.updateRegionLabel();
549
- if (onReady)
550
- onReady(result);
551
- });
552
- }
553
- else {
554
- this.updateRegionLabel();
555
- if (onReady)
556
- onReady(culture.resources);
549
+ if (typeof resources !== 'object') {
550
+ resources = await resources();
551
+ // Set static resources back
552
+ culture.resources = resources;
557
553
  }
554
+ this.updateRegionLabel();
555
+ return resources;
558
556
  }
559
557
  /**
560
558
  * Update current region label
@@ -1208,7 +1206,10 @@ class CoreApp {
1208
1206
  /**
1209
1207
  * Setup callback
1210
1208
  */
1211
- setup() { }
1209
+ setup() {
1210
+ // Restore
1211
+ this.restore();
1212
+ }
1212
1213
  /**
1213
1214
  * Signout
1214
1215
  * @param apiUrl Signout API URL
@@ -159,9 +159,8 @@ export interface IApp {
159
159
  /**
160
160
  * Change culture
161
161
  * @param culture New culture definition
162
- * @param onReady On ready callback
163
162
  */
164
- changeCulture(culture: DataTypes.CultureDefinition, onReady?: (resources: DataTypes.StringRecord) => void): void;
163
+ changeCulture(culture: DataTypes.CultureDefinition): Promise<DataTypes.StringRecord>;
165
164
  /**
166
165
  * Check the action result is about device invalid
167
166
  * @param result Action result
@@ -26,15 +26,15 @@ class AuthApi extends BaseApi_1.BaseApi {
26
26
  * @param payload Payload
27
27
  * @returns Result
28
28
  */
29
- async loginId(id, payload) {
29
+ loginId(id, payload) {
30
30
  const { deviceId, region } = this.app;
31
- id = await this.app.encrypt(id);
31
+ id = this.app.encrypt(id);
32
32
  const rq = {
33
33
  id,
34
34
  deviceId,
35
35
  region
36
36
  };
37
- return await this.api.get('Auth/LoginId', rq, payload);
37
+ return this.api.get('Auth/LoginId', rq, payload);
38
38
  }
39
39
  /**
40
40
  * Reset password
@@ -30,7 +30,7 @@ const shared_1 = require("@etsoo/shared");
30
30
  * @param localResources Local resources
31
31
  * @returns Full culture
32
32
  */
33
- const zhHans = (resources) => shared_1.DomUtils.en(async () => {
33
+ const zhHans = (resources) => shared_1.DomUtils.zhHans(async () => {
34
34
  const [r1, r2] = await Promise.all([
35
35
  Promise.resolve().then(() => __importStar(require('./zh-Hans.json'))),
36
36
  new Promise((resolve) => {
@@ -30,7 +30,7 @@ const shared_1 = require("@etsoo/shared");
30
30
  * @param localResources Local resources
31
31
  * @returns Full culture
32
32
  */
33
- const zhHant = (resources) => shared_1.DomUtils.en(async () => {
33
+ const zhHant = (resources) => shared_1.DomUtils.zhHant(async () => {
34
34
  const [r1, r2] = await Promise.all([
35
35
  Promise.resolve().then(() => __importStar(require('./zh-Hant.json'))),
36
36
  new Promise((resolve) => {
@@ -221,7 +221,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
221
221
  * @param culture New culture definition
222
222
  * @param onReady On ready callback
223
223
  */
224
- changeCulture(culture: DataTypes.CultureDefinition, onReady?: (resources: DataTypes.StringRecord) => void): void;
224
+ changeCulture(culture: DataTypes.CultureDefinition): Promise<DataTypes.StringRecord>;
225
225
  /**
226
226
  * Update current region label
227
227
  */
@@ -9,7 +9,6 @@ import { ActionResultError } from '../result/ActionResultError';
9
9
  import { appFields } from './IApp';
10
10
  import { UserRole } from './UserRole';
11
11
  let CJ;
12
- import('crypto-js').then((result) => (CJ = result));
13
12
  /**
14
13
  * Core application
15
14
  */
@@ -127,12 +126,16 @@ export class CoreApp {
127
126
  this.fields = appFields.reduce((a, v) => ({ ...a, [v]: 'smarterp-' + v + '-' + name }), {});
128
127
  // Device id
129
128
  this._deviceId = storage.getData(this.fields.deviceId, '');
130
- // Restore
131
- this.restore();
132
129
  this.setApi(api);
133
130
  const { currentCulture, currentRegion } = settings;
134
- this.changeCulture(currentCulture, () => this.setup());
135
- this.changeRegion(currentRegion);
131
+ // Load resources
132
+ Promise.all([
133
+ import('crypto-js'),
134
+ this.changeCulture(currentCulture)
135
+ ]).then(([cj, _resources]) => {
136
+ (CJ = cj), this.changeRegion(currentRegion);
137
+ this.setup();
138
+ });
136
139
  }
137
140
  getDeviceId() {
138
141
  return this.deviceId.substring(0, 15);
@@ -194,7 +197,7 @@ export class CoreApp {
194
197
  const passphraseEncrypted = this.storage.getData(this.fields.devicePassphrase);
195
198
  if (passphraseEncrypted) {
196
199
  // this.name to identifier different app's secret
197
- const passphraseDecrypted = await this.decrypt(passphraseEncrypted, this.name);
200
+ const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
198
201
  if (passphraseDecrypted != null) {
199
202
  // Add the device to the list
200
203
  devices.push(d);
@@ -372,7 +375,7 @@ export class CoreApp {
372
375
  return false;
373
376
  // Decrypt
374
377
  // Should be done within 120 seconds after returning from the backend
375
- const passphrase = await this.decrypt(data.passphrase, timestamp.toString());
378
+ const passphrase = this.decrypt(data.passphrase, timestamp.toString());
376
379
  if (passphrase == null)
377
380
  return false;
378
381
  // Update device id and cache it
@@ -384,10 +387,10 @@ export class CoreApp {
384
387
  this.storage.setPersistedData(this.fields.devices, devices);
385
388
  // Current passphrase
386
389
  this.passphrase = passphrase;
387
- this.storage.setData(this.fields.devicePassphrase, await this.encrypt(passphrase, this.name));
390
+ this.storage.setData(this.fields.devicePassphrase, this.encrypt(passphrase, this.name));
388
391
  // Previous passphrase
389
392
  if (data.previousPassphrase) {
390
- const prev = await this.decrypt(data.previousPassphrase, timestamp.toString());
393
+ const prev = this.decrypt(data.previousPassphrase, timestamp.toString());
391
394
  // Update
392
395
  const fields = this.initCallEncryptedUpdateFields();
393
396
  for (const field of fields) {
@@ -402,10 +405,10 @@ export class CoreApp {
402
405
  const enhanced = currentValue.indexOf('!') >= 8;
403
406
  let newValueSource;
404
407
  if (enhanced) {
405
- newValueSource = await this.decryptEnhanced(currentValue, prev, 12);
408
+ newValueSource = this.decryptEnhanced(currentValue, prev, 12);
406
409
  }
407
410
  else {
408
- newValueSource = await this.decrypt(currentValue, prev);
411
+ newValueSource = this.decrypt(currentValue, prev);
409
412
  }
410
413
  if (newValueSource == null || newValueSource === '') {
411
414
  // Reset the field
@@ -413,8 +416,8 @@ export class CoreApp {
413
416
  continue;
414
417
  }
415
418
  const newValue = enhanced
416
- ? await this.encryptEnhanced(newValueSource)
417
- : await this.encrypt(newValueSource);
419
+ ? this.encryptEnhanced(newValueSource)
420
+ : this.encrypt(newValueSource);
418
421
  this.storage.setData(field, newValue);
419
422
  }
420
423
  }
@@ -501,12 +504,13 @@ export class CoreApp {
501
504
  * @param culture New culture definition
502
505
  * @param onReady On ready callback
503
506
  */
504
- changeCulture(culture, onReady) {
507
+ async changeCulture(culture) {
505
508
  // Name
506
509
  const { name } = culture;
507
510
  // Same?
508
- if (this._culture === name)
509
- return;
511
+ let resources = culture.resources;
512
+ if (this._culture === name && typeof resources === 'object')
513
+ return resources;
510
514
  // Save the cultrue to local storage
511
515
  this.storage.setPersistedData(DomUtils.CultureField, name);
512
516
  // Change the API's Content-Language header
@@ -516,19 +520,13 @@ export class CoreApp {
516
520
  this._culture = name;
517
521
  // Hold the current resources
518
522
  this.settings.currentCulture = culture;
519
- if (typeof culture.resources !== 'object') {
520
- culture.resources().then((result) => {
521
- culture.resources = result;
522
- this.updateRegionLabel();
523
- if (onReady)
524
- onReady(result);
525
- });
526
- }
527
- else {
528
- this.updateRegionLabel();
529
- if (onReady)
530
- onReady(culture.resources);
523
+ if (typeof resources !== 'object') {
524
+ resources = await resources();
525
+ // Set static resources back
526
+ culture.resources = resources;
531
527
  }
528
+ this.updateRegionLabel();
529
+ return resources;
532
530
  }
533
531
  /**
534
532
  * Update current region label
@@ -1182,7 +1180,10 @@ export class CoreApp {
1182
1180
  /**
1183
1181
  * Setup callback
1184
1182
  */
1185
- setup() { }
1183
+ setup() {
1184
+ // Restore
1185
+ this.restore();
1186
+ }
1186
1187
  /**
1187
1188
  * Signout
1188
1189
  * @param apiUrl Signout API URL
@@ -159,9 +159,8 @@ export interface IApp {
159
159
  /**
160
160
  * Change culture
161
161
  * @param culture New culture definition
162
- * @param onReady On ready callback
163
162
  */
164
- changeCulture(culture: DataTypes.CultureDefinition, onReady?: (resources: DataTypes.StringRecord) => void): void;
163
+ changeCulture(culture: DataTypes.CultureDefinition): Promise<DataTypes.StringRecord>;
165
164
  /**
166
165
  * Check the action result is about device invalid
167
166
  * @param result Action result
@@ -23,15 +23,15 @@ export class AuthApi extends BaseApi {
23
23
  * @param payload Payload
24
24
  * @returns Result
25
25
  */
26
- async loginId(id, payload) {
26
+ loginId(id, payload) {
27
27
  const { deviceId, region } = this.app;
28
- id = await this.app.encrypt(id);
28
+ id = this.app.encrypt(id);
29
29
  const rq = {
30
30
  id,
31
31
  deviceId,
32
32
  region
33
33
  };
34
- return await this.api.get('Auth/LoginId', rq, payload);
34
+ return this.api.get('Auth/LoginId', rq, payload);
35
35
  }
36
36
  /**
37
37
  * Reset password
@@ -4,7 +4,7 @@ import { DomUtils } from '@etsoo/shared';
4
4
  * @param localResources Local resources
5
5
  * @returns Full culture
6
6
  */
7
- export const zhHans = (resources) => DomUtils.en(async () => {
7
+ export const zhHans = (resources) => DomUtils.zhHans(async () => {
8
8
  const [r1, r2] = await Promise.all([
9
9
  import('./zh-Hans.json'),
10
10
  new Promise((resolve) => {
@@ -4,7 +4,7 @@ import { DomUtils } from '@etsoo/shared';
4
4
  * @param localResources Local resources
5
5
  * @returns Full culture
6
6
  */
7
- export const zhHant = (resources) => DomUtils.en(async () => {
7
+ export const zhHant = (resources) => DomUtils.zhHant(async () => {
8
8
  const [r1, r2] = await Promise.all([
9
9
  import('./zh-Hant.json'),
10
10
  new Promise((resolve) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -42,7 +42,6 @@ import type CryptoJS from 'crypto-js';
42
42
 
43
43
  type CJType = typeof CryptoJS;
44
44
  let CJ: CJType;
45
- import('crypto-js').then((result) => (CJ = result));
46
45
 
47
46
  /**
48
47
  * Core application interface
@@ -271,15 +270,18 @@ export abstract class CoreApp<
271
270
  // Device id
272
271
  this._deviceId = storage.getData(this.fields.deviceId, '');
273
272
 
274
- // Restore
275
- this.restore();
276
-
277
273
  this.setApi(api);
278
274
 
279
275
  const { currentCulture, currentRegion } = settings;
280
- this.changeCulture(currentCulture, () => this.setup());
281
276
 
282
- this.changeRegion(currentRegion);
277
+ // Load resources
278
+ Promise.all([
279
+ import('crypto-js'),
280
+ this.changeCulture(currentCulture)
281
+ ]).then(([cj, _resources]) => {
282
+ (CJ = cj), this.changeRegion(currentRegion);
283
+ this.setup();
284
+ });
283
285
  }
284
286
 
285
287
  private getDeviceId() {
@@ -360,7 +362,7 @@ export abstract class CoreApp<
360
362
  );
361
363
  if (passphraseEncrypted) {
362
364
  // this.name to identifier different app's secret
363
- const passphraseDecrypted = await this.decrypt(
365
+ const passphraseDecrypted = this.decrypt(
364
366
  passphraseEncrypted,
365
367
  this.name
366
368
  );
@@ -576,10 +578,7 @@ export abstract class CoreApp<
576
578
 
577
579
  // Decrypt
578
580
  // Should be done within 120 seconds after returning from the backend
579
- const passphrase = await this.decrypt(
580
- data.passphrase,
581
- timestamp.toString()
582
- );
581
+ const passphrase = this.decrypt(data.passphrase, timestamp.toString());
583
582
  if (passphrase == null) return false;
584
583
 
585
584
  // Update device id and cache it
@@ -598,12 +597,12 @@ export abstract class CoreApp<
598
597
  this.passphrase = passphrase;
599
598
  this.storage.setData(
600
599
  this.fields.devicePassphrase,
601
- await this.encrypt(passphrase, this.name)
600
+ this.encrypt(passphrase, this.name)
602
601
  );
603
602
 
604
603
  // Previous passphrase
605
604
  if (data.previousPassphrase) {
606
- const prev = await this.decrypt(
605
+ const prev = this.decrypt(
607
606
  data.previousPassphrase,
608
607
  timestamp.toString()
609
608
  );
@@ -624,13 +623,13 @@ export abstract class CoreApp<
624
623
  let newValueSource: string | undefined;
625
624
 
626
625
  if (enhanced) {
627
- newValueSource = await this.decryptEnhanced(
626
+ newValueSource = this.decryptEnhanced(
628
627
  currentValue,
629
628
  prev,
630
629
  12
631
630
  );
632
631
  } else {
633
- newValueSource = await this.decrypt(currentValue, prev);
632
+ newValueSource = this.decrypt(currentValue, prev);
634
633
  }
635
634
 
636
635
  if (newValueSource == null || newValueSource === '') {
@@ -640,8 +639,8 @@ export abstract class CoreApp<
640
639
  }
641
640
 
642
641
  const newValue = enhanced
643
- ? await this.encryptEnhanced(newValueSource)
644
- : await this.encrypt(newValueSource);
642
+ ? this.encryptEnhanced(newValueSource)
643
+ : this.encrypt(newValueSource);
645
644
 
646
645
  this.storage.setData(field, newValue);
647
646
  }
@@ -744,15 +743,14 @@ export abstract class CoreApp<
744
743
  * @param culture New culture definition
745
744
  * @param onReady On ready callback
746
745
  */
747
- changeCulture(
748
- culture: DataTypes.CultureDefinition,
749
- onReady?: (resources: DataTypes.StringRecord) => void
750
- ) {
746
+ async changeCulture(culture: DataTypes.CultureDefinition) {
751
747
  // Name
752
748
  const { name } = culture;
753
749
 
754
750
  // Same?
755
- if (this._culture === name) return;
751
+ let resources = culture.resources;
752
+ if (this._culture === name && typeof resources === 'object')
753
+ return resources;
756
754
 
757
755
  // Save the cultrue to local storage
758
756
  this.storage.setPersistedData(DomUtils.CultureField, name);
@@ -767,16 +765,15 @@ export abstract class CoreApp<
767
765
  // Hold the current resources
768
766
  this.settings.currentCulture = culture;
769
767
 
770
- if (typeof culture.resources !== 'object') {
771
- culture.resources().then((result) => {
772
- culture.resources = result;
773
- this.updateRegionLabel();
774
- if (onReady) onReady(result);
775
- });
776
- } else {
777
- this.updateRegionLabel();
778
- if (onReady) onReady(culture.resources);
768
+ if (typeof resources !== 'object') {
769
+ resources = await resources();
770
+
771
+ // Set static resources back
772
+ culture.resources = resources;
779
773
  }
774
+ this.updateRegionLabel();
775
+
776
+ return resources;
780
777
  }
781
778
 
782
779
  /**
@@ -1544,7 +1541,10 @@ export abstract class CoreApp<
1544
1541
  /**
1545
1542
  * Setup callback
1546
1543
  */
1547
- setup() {}
1544
+ setup() {
1545
+ // Restore
1546
+ this.restore();
1547
+ }
1548
1548
 
1549
1549
  /**
1550
1550
  * Signout
package/src/app/IApp.ts CHANGED
@@ -214,12 +214,10 @@ export interface IApp {
214
214
  /**
215
215
  * Change culture
216
216
  * @param culture New culture definition
217
- * @param onReady On ready callback
218
217
  */
219
218
  changeCulture(
220
- culture: DataTypes.CultureDefinition,
221
- onReady?: (resources: DataTypes.StringRecord) => void
222
- ): void;
219
+ culture: DataTypes.CultureDefinition
220
+ ): Promise<DataTypes.StringRecord>;
223
221
 
224
222
  /**
225
223
  * Check the action result is about device invalid
@@ -35,15 +35,15 @@ export class AuthApi extends BaseApi {
35
35
  * @param payload Payload
36
36
  * @returns Result
37
37
  */
38
- async loginId(id: string, payload?: ResultPayload) {
38
+ loginId(id: string, payload?: ResultPayload) {
39
39
  const { deviceId, region } = this.app;
40
- id = await this.app.encrypt(id);
40
+ id = this.app.encrypt(id);
41
41
  const rq: LoginIdRQ = {
42
42
  id,
43
43
  deviceId,
44
44
  region
45
45
  };
46
- return await this.api.get('Auth/LoginId', rq, payload);
46
+ return this.api.get('Auth/LoginId', rq, payload);
47
47
  }
48
48
 
49
49
  /**
@@ -6,7 +6,7 @@ import { DataTypes, DomUtils } from '@etsoo/shared';
6
6
  * @returns Full culture
7
7
  */
8
8
  export const zhHans = (resources: object | (() => Promise<object>)) =>
9
- DomUtils.en(async () => {
9
+ DomUtils.zhHans(async () => {
10
10
  const [r1, r2] = await Promise.all([
11
11
  import('./zh-Hans.json'),
12
12
  new Promise<object>((resolve) => {
@@ -6,7 +6,7 @@ import { DataTypes, DomUtils } from '@etsoo/shared';
6
6
  * @returns Full culture
7
7
  */
8
8
  export const zhHant = (resources: object | (() => Promise<object>)) =>
9
- DomUtils.en(async () => {
9
+ DomUtils.zhHant(async () => {
10
10
  const [r1, r2] = await Promise.all([
11
11
  import('./zh-Hant.json'),
12
12
  new Promise<object>((resolve) => {