argous 1.2.213 → 1.2.214
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/dist/api/index.js +4 -20
- package/lib/api/index.js +3 -23
- package/package.json +1 -1
package/dist/api/index.js
CHANGED
|
@@ -54,13 +54,7 @@ var server = function () { return "://" + config_1.getConfig()[/^[a-z]+.+\.com\.
|
|
|
54
54
|
exports.server = server;
|
|
55
55
|
var api = function () { return "" + (config_1.getConfig().ssl ? 'https' : 'http') + exports.server() + "argous/"; };
|
|
56
56
|
exports.api = api;
|
|
57
|
-
|
|
58
|
-
var headers = function (data) {
|
|
59
|
-
var response = { lgTkn: (data === null || data === void 0 ? void 0 : data.token) ? data.token : utils_1.getCookie('lt') };
|
|
60
|
-
console.log('headers data', data);
|
|
61
|
-
console.log('headers', response);
|
|
62
|
-
return response;
|
|
63
|
-
};
|
|
57
|
+
var headers = function (data) { return ({ lgTkn: (data === null || data === void 0 ? void 0 : data.token) ? data.token : utils_1.getCookie('lt') }); };
|
|
64
58
|
exports.headers = headers;
|
|
65
59
|
/**
|
|
66
60
|
* @deprecated
|
|
@@ -284,26 +278,16 @@ var agSet = function (data) { return __awaiter(void 0, void 0, void 0, function
|
|
|
284
278
|
});
|
|
285
279
|
}); };
|
|
286
280
|
exports.agSet = agSet;
|
|
287
|
-
// export const action = async (data) => {
|
|
288
|
-
// const res = await fetch(`${api()}agaction.rslvr`, {
|
|
289
|
-
// method: 'POST',
|
|
290
|
-
// body: JSON.stringify(data),
|
|
291
|
-
// headers: headers(data)
|
|
292
|
-
// });
|
|
293
|
-
// return await res.json();
|
|
294
|
-
// };
|
|
295
281
|
var action = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
296
|
-
var
|
|
282
|
+
var actionHeaders, res;
|
|
297
283
|
return __generator(this, function (_a) {
|
|
298
284
|
switch (_a.label) {
|
|
299
285
|
case 0:
|
|
300
|
-
|
|
301
|
-
console.log('action data', data);
|
|
302
|
-
console.log('action headers', headersResponse);
|
|
286
|
+
actionHeaders = exports.headers(data);
|
|
303
287
|
return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
|
|
304
288
|
method: 'POST',
|
|
305
289
|
body: JSON.stringify(data),
|
|
306
|
-
headers:
|
|
290
|
+
headers: actionHeaders
|
|
307
291
|
})];
|
|
308
292
|
case 1:
|
|
309
293
|
res = _a.sent();
|
package/lib/api/index.js
CHANGED
|
@@ -5,15 +5,7 @@ export const server = () => `://${getConfig()[/^[a-z]+.+\.com\.br$/.test(window.
|
|
|
5
5
|
|
|
6
6
|
export const api = () => `${getConfig().ssl ? 'https' : 'http'}${server()}argous/`;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
export const headers = (data) => {
|
|
10
|
-
const response = { lgTkn: (data?.token) ? data.token : getCookie('lt') };
|
|
11
|
-
|
|
12
|
-
console.log('headers data', data);
|
|
13
|
-
console.log('headers', response);
|
|
14
|
-
|
|
15
|
-
return response;
|
|
16
|
-
};
|
|
8
|
+
export const headers = (data) => ({ lgTkn: (data?.token) ? data.token : getCookie('lt') });
|
|
17
9
|
|
|
18
10
|
/**
|
|
19
11
|
* @deprecated
|
|
@@ -141,24 +133,12 @@ export const agSet = async (data) => {
|
|
|
141
133
|
return await res.json();
|
|
142
134
|
};
|
|
143
135
|
|
|
144
|
-
// export const action = async (data) => {
|
|
145
|
-
// const res = await fetch(`${api()}agaction.rslvr`, {
|
|
146
|
-
// method: 'POST',
|
|
147
|
-
// body: JSON.stringify(data),
|
|
148
|
-
// headers: headers(data)
|
|
149
|
-
// });
|
|
150
|
-
// return await res.json();
|
|
151
|
-
// };
|
|
152
136
|
export const action = async (data) => {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
console.log('action data', data);
|
|
156
|
-
console.log('action headers', headersResponse);
|
|
157
|
-
|
|
137
|
+
const actionHeaders = headers(data);
|
|
158
138
|
const res = await fetch(`${api()}agaction.rslvr`, {
|
|
159
139
|
method: 'POST',
|
|
160
140
|
body: JSON.stringify(data),
|
|
161
|
-
headers:
|
|
141
|
+
headers: actionHeaders
|
|
162
142
|
});
|
|
163
143
|
return await res.json();
|
|
164
144
|
};
|