flamerest 1.0.71 → 1.0.73
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/REST.js +5 -2
- package/package.json +1 -1
package/REST.js
CHANGED
|
@@ -67,7 +67,7 @@ class FLAMEREST {
|
|
|
67
67
|
try {
|
|
68
68
|
|
|
69
69
|
// Авторизация
|
|
70
|
-
if (this.isAuthByJWTQuery && isNeedToken === true && this.token !== null) {
|
|
70
|
+
if (this.isAuthByJWTQuery && isNeedToken === true && this.token !== null && this.token !== undefined && this.token !== 'undefined') {
|
|
71
71
|
url = url + "?access-token=" + this.token;
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -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
|
}
|