flamerest 1.0.36 → 1.0.37
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 +18 -4
- package/package.json +1 -1
package/REST.js
CHANGED
|
@@ -443,12 +443,26 @@ class FLAMEREST {
|
|
|
443
443
|
return new Promise((resolve, reject) => { resolve(JSON.parse(window.sessionStorage.getItem("crudschema"))) });
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
auth(username, password) {
|
|
447
|
-
|
|
446
|
+
async auth(username, password) {
|
|
447
|
+
|
|
448
|
+
let resp = await this.request(this.SERVER + '/auth/auth', JSON.stringify({ login: username, password: password }), 'POST');
|
|
449
|
+
|
|
450
|
+
if(resp.errors) return resp;
|
|
451
|
+
if(resp.data.length === 0) {resp.errors = []; return resp;}
|
|
452
|
+
|
|
453
|
+
return resp.data;
|
|
454
|
+
|
|
448
455
|
}
|
|
449
456
|
|
|
450
|
-
signup(username, password) {
|
|
451
|
-
|
|
457
|
+
async signup(username, password) {
|
|
458
|
+
|
|
459
|
+
let resp = await this.request(this.SERVER + '/auth/signup', JSON.stringify({ login: username, password: password }), 'POST');
|
|
460
|
+
|
|
461
|
+
if(resp.errors) return resp;
|
|
462
|
+
if(resp.data.length === 0) {resp.errors = []; return resp;}
|
|
463
|
+
|
|
464
|
+
return resp.data;
|
|
465
|
+
|
|
452
466
|
}
|
|
453
467
|
|
|
454
468
|
logout() {
|