flamerest 1.0.85 → 1.0.87
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.d.ts +2 -1
- package/REST.js +5 -4
- package/package.json +1 -1
package/REST.d.ts
CHANGED
|
@@ -43,8 +43,9 @@ interface IREST {
|
|
|
43
43
|
* @param {object|string} params Параметры, которые надо передать, могут быть в виде объекта или строки
|
|
44
44
|
* @param {string} type Тип
|
|
45
45
|
* @param {string} responseType Тип ответа: json или blob
|
|
46
|
+
* @param {Object} customHeaders объект с доп заголовками, которые надо включить в запрос
|
|
46
47
|
*/
|
|
47
|
-
request(url: string, params: object | string, type?: string, responseType?: string): object,
|
|
48
|
+
request(url: string, params: object | string, type?: string, responseType?: string, customHeaders?: object): object,
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
51
|
* Получить выборку из таблицы через REST
|
package/REST.js
CHANGED
|
@@ -54,8 +54,9 @@ class FLAMEREST {
|
|
|
54
54
|
* @param {object|string} params Параметры, которые надо передать, могут быть в виде объекта или строки
|
|
55
55
|
* @param {string} type Тип
|
|
56
56
|
* @param {string} responseType Тип ответа: json или blob
|
|
57
|
+
* @param {Object} customHeaders объект с доп заголовками, которые надо включить в запрос
|
|
57
58
|
*/
|
|
58
|
-
request(url, params, type = 'GET', responseType = 'json', isNeedToken = true) {
|
|
59
|
+
request(url, params, type = 'GET', responseType = 'json', isNeedToken = true, customHeaders = {}) {
|
|
59
60
|
|
|
60
61
|
// Нормализуем параметры, если они есть
|
|
61
62
|
if (typeof params === "object") {
|
|
@@ -80,9 +81,9 @@ class FLAMEREST {
|
|
|
80
81
|
let requestBody = {
|
|
81
82
|
method: type,
|
|
82
83
|
mode: 'cors',
|
|
83
|
-
headers: {
|
|
84
|
+
headers: Object.assign({
|
|
84
85
|
'Content-type': 'application/json; charset=utf-8'
|
|
85
|
-
}
|
|
86
|
+
}, customHeaders)
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
if (type !== 'GET')
|
|
@@ -490,7 +491,7 @@ class FLAMEREST {
|
|
|
490
491
|
return new Promise((resolve, reject) => { resolve(JSON.parse(window.sessionStorage.getItem("crudschema"))) });
|
|
491
492
|
}
|
|
492
493
|
|
|
493
|
-
async auth(username, password,
|
|
494
|
+
async auth(username, password, pushNotificationToken) {
|
|
494
495
|
|
|
495
496
|
let resp = null;
|
|
496
497
|
if (this.token !== null && this.token !== undefined && this.token !== 'undefined' && (username === null || username === undefined)) {
|