flamerest 1.0.71 → 1.0.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.
Files changed (2) hide show
  1. package/REST.js +4 -1
  2. package/package.json +1 -1
package/REST.js CHANGED
@@ -482,7 +482,7 @@ class FLAMEREST {
482
482
  async auth(username, password, isNeedToken) {
483
483
 
484
484
  let resp = null;
485
- if (this.token !== null && this.token !== 'undefined' && (username === null || username === undefined)) {
485
+ if (this.token !== null && this.token !== undefined && this.token !== 'undefined' && (username === null || username === undefined)) {
486
486
  resp = await this.request(this.SERVER + '/auth/auth', JSON.stringify({}), 'POST', 'json', true);
487
487
  }
488
488
  else {
@@ -506,6 +506,9 @@ class FLAMEREST {
506
506
  if (resp.errors) return resp;
507
507
  if (resp.data.length === 0) { resp.errors = []; return resp; }
508
508
 
509
+ // после успешной авторизации устанавливаем токен
510
+ if (typeof resp.token === 'string') this.token = resp.token;
511
+
509
512
  return resp.data;
510
513
 
511
514
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flamerest",
3
- "version": "1.0.71",
3
+ "version": "1.0.72",
4
4
  "description": "",
5
5
  "main": "REST.js",
6
6
  "typings": "./REST.d.ts",