flamerest 1.0.25 → 1.0.26
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 +10 -5
- package/package.json +1 -1
package/REST.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
class FLAMEREST {
|
|
3
3
|
|
|
4
|
-
constructor(server_address, localhost_endpoint, unauthorized_callback) {
|
|
4
|
+
constructor(server_address, localhost_endpoint, unauthorized_callback, version) {
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Адрес серва
|
|
@@ -25,6 +25,11 @@ class FLAMEREST {
|
|
|
25
25
|
*/
|
|
26
26
|
this.unauthorized_callback = unauthorized_callback;
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Версия api
|
|
30
|
+
*/
|
|
31
|
+
this.version = version ? version : 'v1';
|
|
32
|
+
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
install(Vue, options) {
|
|
@@ -300,7 +305,7 @@ class FLAMEREST {
|
|
|
300
305
|
let responseType = "json";
|
|
301
306
|
|
|
302
307
|
// Генерим запрос
|
|
303
|
-
let query = this.SERVER + '/api/' + table;
|
|
308
|
+
let query = this.SERVER + '/api/' + this.version + '/' + table;
|
|
304
309
|
|
|
305
310
|
let json = {};
|
|
306
311
|
|
|
@@ -376,7 +381,7 @@ class FLAMEREST {
|
|
|
376
381
|
// Подготовить значения
|
|
377
382
|
await this.prepare(values);
|
|
378
383
|
|
|
379
|
-
return this.request(this.SERVER + '/api/' + table + '/create', JSON.stringify(values), 'POST');
|
|
384
|
+
return this.request(this.SERVER + '/api/' + this.version + '/' + table + '/create', JSON.stringify(values), 'POST');
|
|
380
385
|
|
|
381
386
|
}
|
|
382
387
|
|
|
@@ -390,7 +395,7 @@ class FLAMEREST {
|
|
|
390
395
|
// Нормализуем имена таблиц
|
|
391
396
|
table = table.replace(/_/g, "");
|
|
392
397
|
|
|
393
|
-
return this.request(this.SERVER + '/api/' + table + '/delete?id=' + id, '{}', 'DELETE');
|
|
398
|
+
return this.request(this.SERVER + '/api/' + this.version + '/' + table + '/delete?id=' + id, '{}', 'DELETE');
|
|
394
399
|
|
|
395
400
|
}
|
|
396
401
|
|
|
@@ -408,7 +413,7 @@ class FLAMEREST {
|
|
|
408
413
|
// Подготовить значения
|
|
409
414
|
await this.prepare(values);
|
|
410
415
|
|
|
411
|
-
return this.request(this.SERVER + '/api/' + table + '/update?id=' + ID, JSON.stringify(values), 'PATCH');
|
|
416
|
+
return this.request(this.SERVER + '/api/' + this.version + '/' + table + '/update?id=' + ID, JSON.stringify(values), 'PATCH');
|
|
412
417
|
}
|
|
413
418
|
|
|
414
419
|
/**
|